实体模型
public partial class Categoies
{
public Categoies()
{
this.Posts = new HashSet<Posts>();
}
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Nullable<int> PositionId { get; set; }
public virtual CategoryPositions CategoryPositions { get; set; }
public virtual ICollection<Posts> Posts { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
查看模型
public class CategoriesViewModel
{
public int Id { get; set; }
[Required(ErrorMessage = "{0} alan? bo? b?rak?lmamal?d?r!")]
[Display(Name = "Kategori …Run Code Online (Sandbox Code Playgroud) 在我的解决方案中,我有一个ASP.NET MVC3项目,以及一个与数据库一起工作的WCF项目.我使用entity framework self tracking和AutoMapper映射对象.
我的问题是:我如何使用AutoMapper邮政行动像箱子和删除和编辑方法
我看到这个问题,但没有帮助我这给我一个错误argument type '...' is not assignable to parameter type '...'
[HttpPost]
public ActionResult Create(MUser muser)
{
if (ModelState.IsValid)
{
Mapper.CreateMap<User, MUser>();
var user = Mapper.Map<User, MUser>(muser);
_proxy.SaveUser(user);
return RedirectToAction("Index");
}
return View(muser);
}
Run Code Online (Sandbox Code Playgroud)
