示例#1
0
 public ActionResult Get(int? id)
 {
     var model = new ProdusModel();
     if (id > 0)
     {
         model = ProdusRepository.Select(x => x.ID == id).FirstOrDefault().ToModel();
     }
     return PartialView("_Edit", model);
 }
示例#2
0
        public ActionResult Save(ProdusModel model)
        {
            if (ModelState.IsValid)
            {
                var entity = ProdusRepository.Select(x => x.ID == model.Id).FirstOrDefault() ?? new Produ();

                model.ToEntity(ref entity);

                ProdusRepository.Insert(entity);

                return Json(new { success = true });
            }
            return PartialView("_Edit", model);
        }