Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Entity framework 如何发布一些<;T>;数据到MVC操作? 公共类图形 { ... ... [脚手架立柱(假)] 公共int GraphicId{get;set;} 公共虚拟ICollection GraphicArtworks{get;set;} } 公共级图形艺术品 { [关键] 公共int graphicartworkind{get;set;} 公共int GraphisId{get;set;} [必需(ErrorMessage=“需要{0}”)] [长度(500)] 公共字符串ArtOptionText{get;set;} 公共十进制价格{get;set;} [显示名称(“活动”)] 公共bool IsActive{get;set;} 公共日期时间CreatedDate{get;set;} [未映射] 公共int TotalRecordCount{get;set;} }_Entity Framework_Asp.net Mvc 4_Knockout.js - Fatal编程技术网

Entity framework 如何发布一些<;T>;数据到MVC操作? 公共类图形 { ... ... [脚手架立柱(假)] 公共int GraphicId{get;set;} 公共虚拟ICollection GraphicArtworks{get;set;} } 公共级图形艺术品 { [关键] 公共int graphicartworkind{get;set;} 公共int GraphisId{get;set;} [必需(ErrorMessage=“需要{0}”)] [长度(500)] 公共字符串ArtOptionText{get;set;} 公共十进制价格{get;set;} [显示名称(“活动”)] 公共bool IsActive{get;set;} 公共日期时间CreatedDate{get;set;} [未映射] 公共int TotalRecordCount{get;set;} }

Entity framework 如何发布一些<;T>;数据到MVC操作? 公共类图形 { ... ... [脚手架立柱(假)] 公共int GraphicId{get;set;} 公共虚拟ICollection GraphicArtworks{get;set;} } 公共级图形艺术品 { [关键] 公共int graphicartworkind{get;set;} 公共int GraphisId{get;set;} [必需(ErrorMessage=“需要{0}”)] [长度(500)] 公共字符串ArtOptionText{get;set;} 公共十进制价格{get;set;} [显示名称(“活动”)] 公共bool IsActive{get;set;} 公共日期时间CreatedDate{get;set;} [未映射] 公共int TotalRecordCount{get;set;} },entity-framework,asp.net-mvc-4,knockout.js,Entity Framework,Asp.net Mvc 4,Knockout.js,我有这两张桌子和一个模型。这里我有一个图形与许多艺术作品的选择。我已经使用Knockout.js在视图中创建了我的Artwork选项。现在我的问题是,如何发布(操作方法)这些数据,以便插入GraphicArtwork表 我需要客户端逻辑,以便获得此值 public class Graphic { ... ... [ScaffoldColumn(false)] public int GraphicId { get; set; } public virtual

我有这两张桌子和一个模型。这里我有一个图形与许多艺术作品的选择。我已经使用Knockout.js在视图中创建了我的Artwork选项。现在我的问题是,如何发布(操作方法)这些数据,以便插入GraphicArtwork表


我需要客户端逻辑,以便获得此值
public class Graphic
{
    ...
    ...
    [ScaffoldColumn(false)]
    public int GraphicId { get; set; }
    public virtual ICollection<GraphicArtwork> GraphicArtworks { get; set; }
}

public class GraphicArtwork
{
    [Key]
    public int GraphicArtworkId { get; set; }
    public int GraphisId { get; set; }
    [Required(ErrorMessage = "The {0} is required.")]
    [StringLength(500)]
    public string ArtOptionText { get; set; }
    public decimal Price { get; set; }
    [DisplayName("Active")]
    public bool IsActive { get; set; }
    public DateTime CreatedDate { get; set; }
    [NotMapped]
    public int TotalRecordCount { get; set; }
}
[HttpPost]
public ActionResult Add(Graphic data)
{
  // "data" will contain all posted values  
}