public ActionResult Update(int Id) { var result = _factorysContract.View(Id); Mapper.CreateMap <Factorys, FactorysDto>(); FactorysDto dto = Mapper.Map <Factorys, FactorysDto>(result); ViewBag.Departments = CacheAccess.GetDepartmentListItem(_DepartmentContract, true, DepartmentTypeFlag.设计); ViewBag.Brands = CacheAccess.GetBrand(_brandContract, true, false); ViewBag.Stores = result.Department.Stores.Where(w => w.IsEnabled && !w.IsDeleted).Select(s => new SelectListItem { Value = s.Id + "", Text = s.StoreName, }).ToList(); ViewBag.Storages = _StoreContract.Stores.Where(w => w.IsEnabled && !w.IsDeleted && w.Id == result.StoreId).SelectMany(s => s.Storages) .Where(w => w.IsEnabled && !w.IsDeleted).Select(s => new SelectListItem { Value = s.Id + "", Text = s.StorageName, }).ToList(); return(PartialView(dto)); }
public ActionResult Update(FactorysDto dto) { var result = _factorysContract.Update(dto); return(Json(result)); }
public ActionResult Create(FactorysDto drod) { OperationResult oper = _factorysContract.Insert(drod); return(Json(oper)); }