public IActionResult Edit(WarehouseBranchViewModel model) { var branch = _warehouseBranchService.GetById(model.Id); branch.Name = model.Name; branch.Address = model.Address; branch.Telephone = model.Telephone; branch.OpenDate = model.OpenDate; branch.ImageUrl = model.ImageUrl; _warehouseBranchService.Edit(branch); return(RedirectToAction("Index")); }
public IActionResult Edit(int id) { var branch = _warehouseBranchService.GetById(id); var model = new WarehouseBranchViewModel { Name = branch.Name, Address = branch.Address, Telephone = branch.Telephone, OpenDate = branch.OpenDate, ImageUrl = branch.ImageUrl }; return(View(model)); }
public IActionResult Create(WarehouseBranchViewModel model) { if (ModelState.IsValid) { var branch = new WarehouseBranch { Id = model.Id, Name = model.Name, Address = model.Address, Telephone = model.Telephone, OpenDate = model.OpenDate, ImageUrl = model.ImageUrl }; _warehouseBranchService.Add(branch); return(RedirectToAction("Index")); } return(View()); }
public IActionResult Detail(int id) { var branch = _warehouseBranchService.GetById(id); var model = new WarehouseBranchViewModel { Id = branch.Id, Name = branch.Name, Address = branch.Address, Telephone = branch.Telephone, OpenDate = branch.OpenDate, ImageUrl = branch.ImageUrl, TotalAssetValue = _warehouseBranchService.GetAssetsValue(id), NumberOfAssets = _warehouseBranchService.GetAssetCount(branch.Id), NumberOfEmployees = _warehouseBranchService.GetEmployeeCount(branch.Id), }; return(View(model)); }