public ActionResult Edit(DeliveryTimeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageDeliveryTimes)) { return(AccessDeniedView()); } var deliveryTime = _deliveryTimeService.GetDeliveryTimeById(model.Id); if (deliveryTime == null) { //No currency found with the specified id return(RedirectToAction("List")); } if (ModelState.IsValid) { deliveryTime = model.ToEntity(deliveryTime); UpdateLocales(deliveryTime, model); _deliveryTimeService.UpdateDeliveryTime(deliveryTime); NotifySuccess(_localizationService.GetResource("Admin.Configuration.DeliveryTimes.Updated")); return(continueEditing ? RedirectToAction("Edit", new { id = deliveryTime.Id }) : RedirectToAction("List")); } return(View(model)); }
public void UpdateLocales(DeliveryTime deliveryTime, DeliveryTimeModel model) { foreach (var localized in model.Locales) { _localizedEntityService.SaveLocalizedValue(deliveryTime, x => x.Name, localized.Name, localized.LanguageId); } }
public ActionResult CreateDeliveryTimePopup(string btnId, DeliveryTimeModel model) { if (ModelState.IsValid) { try { var entity = model.ToEntity(); _deliveryTimeService.InsertDeliveryTime(entity); UpdateLocales(entity, model); NotifySuccess(T("Admin.Configuration.DeliveryTime.Added")); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(model)); } ViewBag.RefreshPage = true; ViewBag.btnId = btnId; } return(View(model)); }
public ActionResult Edit(DeliveryTimeModel model, bool continueEditing) { if (!Services.Permissions.Authorize(StandardPermissionProvider.ManageDeliveryTimes)) { return(AccessDeniedView()); } var deliveryTime = _deliveryTimeService.GetDeliveryTimeById(model.Id); if (deliveryTime == null) { return(RedirectToAction("List")); } if (ModelState.IsValid) { deliveryTime = model.ToEntity(deliveryTime); // if this is the default delivery time set all other delivery times to non default if (model.IsDefault) { _deliveryTimeService.SetToDefault(deliveryTime); } UpdateLocales(deliveryTime, model); _deliveryTimeService.UpdateDeliveryTime(deliveryTime); NotifySuccess(T("Admin.Configuration.DeliveryTimes.Updated")); return(continueEditing ? RedirectToAction("Edit", new { id = deliveryTime.Id }) : RedirectToAction("List")); } return(View(model)); }
public ActionResult CreateDeliveryTimePopup() { var model = new DeliveryTimeModel(); AddLocales(_languageService, model.Locales); return(View(model)); }
public ActionResult Create() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageDeliveryTimes)) return AccessDeniedView(); var model = new DeliveryTimeModel(); //locales AddLocales(_languageService, model.Locales); return View(model); }
public ActionResult Create() { if (!Services.Permissions.Authorize(StandardPermissionProvider.ManageDeliveryTimes)) { return(AccessDeniedView()); } var model = new DeliveryTimeModel(); AddLocales(_languageService, model.Locales); return(View(model)); }
public ActionResult Create(DeliveryTimeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageDeliveryTimes)) { return(AccessDeniedView()); } if (ModelState.IsValid) { var deliveryTime = model.ToEntity(); _deliveryTimeService.InsertDeliveryTime(deliveryTime); //locales UpdateLocales(deliveryTime, model); NotifySuccess(_localizationService.GetResource("Admin.Configuration.DeliveryTime.Added")); return(continueEditing ? RedirectToAction("Edit", new { id = deliveryTime.Id }) : RedirectToAction("List")); } //If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult EditDeliveryTimePopup(string btnId, DeliveryTimeModel model) { var entity = _deliveryTimeService.GetDeliveryTimeById(model.Id); if (entity == null) { return(HttpNotFound()); } if (ModelState.IsValid) { try { entity = model.ToEntity(entity); // If this is the default delivery time set all other delivery times to non default. if (model.IsDefault) { _deliveryTimeService.SetToDefault(entity); } _deliveryTimeService.UpdateDeliveryTime(entity); UpdateLocales(entity, model); NotifySuccess(T("Admin.Configuration.DeliveryTimes.Updated")); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(model)); } ViewBag.RefreshPage = true; ViewBag.btnId = btnId; } return(View(model)); }
public static DeliveryTime ToEntity(this DeliveryTimeModel model, DeliveryTime destination) { return(Mapper.Map(model, destination)); }
public static DeliveryTime ToEntity(this DeliveryTimeModel model) { return(Mapper.Map <DeliveryTimeModel, DeliveryTime>(model)); }
public static DeliveryTime ToEntity(this DeliveryTimeModel model, DeliveryTime entity) { MapperFactory.Map(model, entity); return(entity); }
public ActionResult Create(DeliveryTimeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageDeliveryTimes)) return AccessDeniedView(); if (ModelState.IsValid) { var deliveryTime = model.ToEntity(); _deliveryTimeService.InsertDeliveryTime(deliveryTime); //locales UpdateLocales(deliveryTime, model); NotifySuccess(_localizationService.GetResource("Admin.Configuration.DeliveryTime.Added")); return continueEditing ? RedirectToAction("Edit", new { id = deliveryTime.Id }) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form return View(model); }
public ActionResult Edit(DeliveryTimeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageDeliveryTimes)) return AccessDeniedView(); var deliveryTime = _deliveryTimeService.GetDeliveryTimeById(model.Id); if (deliveryTime == null) //No currency found with the specified id return RedirectToAction("List"); if (ModelState.IsValid) { deliveryTime = model.ToEntity(deliveryTime); UpdateLocales(deliveryTime, model); _deliveryTimeService.UpdateDeliveryTime(deliveryTime); NotifySuccess(_localizationService.GetResource("Admin.Configuration.DeliveryTimes.Updated")); return continueEditing ? RedirectToAction("Edit", new { id = deliveryTime.Id }) : RedirectToAction("List"); } return View(model); }
public static DeliveryTime ToEntity(this DeliveryTimeModel model) { return(AutoMapperConfiguration.Mapper.Map <DeliveryTimeModel, DeliveryTime>(model)); }