public bool Put(int id, OutletDto outletmodel) { var outlet = _mapper.Map <Outlet1>(outletmodel); var result = _outletservice.UpdateOutlet(id, outlet); return(result); }
public ActionResult Outlet(OutletModel outletModel, string submitButton) { int result = 0; outletModel.StoreList = _iDropDownService.GetStoreList(); if (!ModelState.IsValid) { string errorString = this.ValidationOutlet(outletModel); if (!string.IsNullOrEmpty(errorString)) { ViewBag.Validate = errorString; return(View(outletModel)); } } if (outletModel.Id > 0) { result = _iOutletService.UpdateOutlet(outletModel); if (result == -1) { ViewBag.Result = _locService.GetLocalizedHtmlString("Store is already allocated to other outlet!"); ViewBag.UpdateError = _locService.GetLocalizedHtmlString("UpdateError"); return(View(outletModel)); } else { ViewBag.Result = _locService.GetLocalizedHtmlString("EditSuccss"); } } else { result = _iOutletService.InsertOutlet(outletModel); if (result == -1) { ViewBag.Result = _locService.GetLocalizedHtmlString("Store is already allocated to other outlet!"); ViewBag.SaveError = _locService.GetLocalizedHtmlString("SaveError"); return(View(outletModel)); } else { ViewBag.Result = _locService.GetLocalizedHtmlString("SaveSuccess"); } } return(RedirectToAction("Index", "Outlet")); }
public async Task <IActionResult> Edit(long id, OutletCreateViewModel outletViewModel) { if (id != outletViewModel.Id) { return(NotFound()); } if (string.IsNullOrEmpty(outletViewModel.ImageUrl) && (outletViewModel.File == null || outletViewModel.File.Length <= 0)) { ModelState.AddModelError("", "Outlet logo requried"); } if (ModelState.IsValid) { if (string.IsNullOrEmpty(outletViewModel.ImageUrl) && outletViewModel.File != null && outletViewModel.File.Length > 0) { outletViewModel.ImageUrl = await _fileServices.SaveFile(outletViewModel.File); } var outlet = _mapper.Map <Outlet>(outletViewModel); await _outletService.UpdateOutlet(id, outlet); return(RedirectToAction(nameof(Index))); } return(View(outletViewModel)); }