public ActionResult Upload() { var model = new LocationMappingModel(); model.MainMenu = _mainMenu; model.CurrentLogin = CurrentUser; return(View(model)); }
public ActionResult Index() { var dto = new LocationMappingDto(); var data = _locationMappingBLL.GetLocationMapping(); var model = new LocationMappingModel(); model.Details = Mapper.Map <List <LocationMappingItem> >(data); model.MainMenu = _mainMenu; model.CurrentLogin = CurrentUser; model.CurrentPageAccess = CurrentPageAccess; return(View(model)); }
public ActionResult Upload(LocationMappingModel Model) { if (ModelState.IsValid) { foreach (LocationMappingItem data in Model.Details) { try { data.CreatedDate = DateTime.Now; data.CreatedBy = CurrentUser.USERNAME; data.ModifiedDate = null; data.IsActive = true; // data.ValidFrom = Convert.ToDateTime(data.ValidFromS); var dto = Mapper.Map <LocationMappingDto>(data); if (data.ErrorMessage == "" | data.ErrorMessage == null) { _locationMappingBLL.Save(dto);; } } catch (Exception exception) { var msg = exception.Message; Model.MainMenu = _mainMenu; Model.CurrentLogin = CurrentUser; return(View(Model)); } } try { _locationMappingBLL.SaveChanges(); } catch (Exception exception) { var msg = exception.Message; Model.MainMenu = _mainMenu; Model.CurrentLogin = CurrentUser; return(View(Model)); } } return(RedirectToAction("Index", "MstLocationMapping")); }