public ActionResult Approved(string[] ids, int value) { try { if (ids.Length != 0) { string[] strArrays = ids; for (int i = 0; i < (int)strArrays.Length; i++) { int num = int.Parse(strArrays[i]); LandingPage landingPage = this._landingPageService.Get((LandingPage x) => x.Id == num, false); landingPage.Status = 3; this._landingPageService.Update(landingPage); } base.Response.Cookies.Add(new HttpCookie("system_message", MessageUI.UpdateSuccess)); } } catch (Exception exception1) { Exception exception = exception1; base.Response.Cookies.Add(new HttpCookie("system_message", "Cập nhật không thành công.")); ExtentionUtils.Log(string.Concat("ContactInformation.Delete: ", exception.Message)); } return(base.RedirectToAction("Index")); }
public ActionResult Approved(string[] ids, int value) { try { if (ids.Length != 0) { var strArrays = ids; for (var i = 0; i < strArrays.Length; i++) { var num = int.Parse(strArrays[i]); var landingPage = _landingPageService.Get(x => x.Id == num); landingPage.Status = 3; _landingPageService.Update(landingPage); } Response.Cookies.Add(new HttpCookie("system_message", MessageUI.UpdateSuccess)); } } catch (Exception exception1) { var exception = exception1; Response.Cookies.Add(new HttpCookie("system_message", "Cập nhật không thành công.")); ExtentionUtils.Log(string.Concat("ContactInformation.Delete: ", exception.Message)); } return(RedirectToAction("Index")); }
public ActionResult Create(GenericControlValueViewModel model, string ReturnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { base.ModelState.AddModelError("", MessageUI.ErrorMessage); return(base.View(model)); } else { GenericControlValue modelMap = Mapper.Map <GenericControlValueViewModel, GenericControlValue>(model); this._genericControlValueService.Create(modelMap); base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.CreateSuccess, FormUI.Name))); if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); } else { action = this.Redirect(ReturnUrl); } } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("GenericControlValue.Create: ", exception.Message)); return(base.View(model)); } return(action); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { IEnumerable <GenericControl> GenericControls = from id in ids select this._genericControlService.GetById(int.Parse(id)); this._genericControlService.BatchDelete(GenericControls); //Delete localize for (int i = 0; i < ids.Length; i++) { IEnumerable <LocalizedProperty> ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); this._localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("ServerGenericControl.Delete: ", exception.Message)); } return(base.RedirectToAction("Index")); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { foreach (string id in ids) { Guid userId = Guid.Parse(id); IdentityUser objUser = (from user in ids select _userManager.FindById(userId)).FirstOrDefault(); //Task<IList<UserLoginInfo>> loginInfo = _userLoginStore.GetLoginsAsync(objUser); //_userLoginStore.RemoveLoginAsync(objUser, loginInfo); IList <string> lstUserRole = _userManager.GetRoles(userId); _userManager.RemoveFromRoles(userId, lstUserRole.ToArray()); _userManager.Update(objUser); _userManager.Delete(objUser); } } } catch (Exception ex) { ExtentionUtils.Log(string.Concat("Post.Delete: ", ex.Message)); } return(base.RedirectToAction("Index")); }
public ActionResult Create(ServerMailSettingViewModel serverMail, string returnUrl) { ActionResult action; try { if (!ModelState.IsValid) { ModelState.AddModelError("", MessageUI.ErrorMessage); return(View(serverMail)); } var serverMailSetting = Mapper.Map <ServerMailSettingViewModel, ServerMailSetting>(serverMail); _mailSettingService.Create(serverMailSetting); Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.CreateSuccess, FormUI.ServerMailSetting))); if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\")) { action = RedirectToAction("Index"); } else { action = Redirect(returnUrl); } } catch (Exception exception1) { var exception = exception1; ExtentionUtils.Log(string.Concat("MailSetting.Create: ", exception.Message)); return(View(serverMail)); } return(action); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { var repairs = new List <Repair>(); var repairGalleries = new List <RepairGallery>(); var strArrays = ids; for (var i = 0; i < strArrays.Length; i++) { var num = int.Parse(strArrays[i]); var repair = _repairService.Get(x => x.Id == num); repairGalleries.AddRange(repair.RepairGalleries.ToList()); repairs.Add(repair); } _galleryService.BatchDelete(repairGalleries); _repairService.BatchDelete(repairs); } } catch (Exception exception1) { var exception = exception1; ExtentionUtils.Log(string.Concat("Repair.Delete: ", exception.Message)); } return(RedirectToAction("Index")); }
public JsonResult Update(string param) { try { //var data = JsonConvert.DeserializeObject<GenericControlValueResponseCollection>(param); //foreach (GenericControlValueItem item in data.GenericControlValueItem) //{ // //Get data // GenericControlValueItem model = _genericControlValueItemService.Get((GenericControlValueItem x) => x.Id == item.Id && x.EntityId == item.EntityId); // if (model != null) // { // // model = new GenericControlValueItem(); // model.ColorHex = item.ColorHex; // model.EntityId = entityId; // _genericControlValueItemService.Create(model); // } //} } catch (Exception exception) { ExtentionUtils.Log(string.Concat("District.Edit: ", exception.Message)); } JsonResult jsonResult = Json(new { success = true }, JsonRequestBehavior.AllowGet); return(jsonResult); }
public ActionResult Edit(PageBannerViewModel pageBannerModel, string returnUrl) { ActionResult action; try { if (!ModelState.IsValid) { ModelState.AddModelError("", MessageUI.ErrorMessage); return(View(pageBannerModel)); } var byId = _pageBannerService.GetById(pageBannerModel.Id); var pageBanner = Mapper.Map(pageBannerModel, byId); _pageBannerService.Update(pageBanner); Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.PageBanner))); if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\")) { action = RedirectToAction("Index"); } else { action = Redirect(returnUrl); } } catch (Exception exception1) { var exception = exception1; ModelState.AddModelError("", exception.Message); ExtentionUtils.Log(string.Concat("PageBanner.Edit: ", exception.Message)); return(View(pageBannerModel)); } return(action); }
public ActionResult Edit(OrderViewModel OrderView, string ReturnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { base.ModelState.AddModelError("", MessageUI.ErrorMessage); return(base.View(OrderView)); } else { Order map = Mapper.Map <OrderViewModel, Order>(OrderView); this._orderService.Update(map); base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.Order))); if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); } else { action = this.Redirect(ReturnUrl); } } } catch (Exception ex) { ExtentionUtils.Log(string.Concat("Order.Edit: ", ex.Message)); return(base.View(OrderView)); } return(action); }
public ActionResult Delete(int[] ids) { try { if (ids.Length != 0) { int[] numArray = ids; for (int i = 0; i < (int)numArray.Length; i++) { int num = numArray[i]; SlideShow slideShow = this._slideShowService.Get((SlideShow x) => x.Id == num, false); this._slideShowService.Delete(slideShow); //Delete localize IEnumerable <LocalizedProperty> ieLocalizedProperty = _localizedPropertyService.GetByEntityId(num); this._localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("SlideShow.Delete: ", exception.Message)); } return(base.RedirectToAction("Index")); }
public ActionResult Create(AttributeValueViewModel attributeValue, string returnUrl) { ActionResult action; try { if (!ModelState.IsValid) { ModelState.AddModelError("", MessageUI.ErrorMessage); return(View(attributeValue)); } var attributeValue1 = Mapper.Map <AttributeValueViewModel, AttributeValue>(attributeValue); _attributeValueService.Create(attributeValue1); Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.CreateSuccess, FormUI.AttributeValue))); if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\")) { action = RedirectToAction("Index"); } else { action = Redirect(returnUrl); } } catch (Exception exception1) { var exception = exception1; ExtentionUtils.Log(string.Concat("District.Create: ", exception.Message)); return(View(attributeValue)); } return(action); }
public ActionResult Edit(BrandViewModel model, string returnUrl) { try { if (!ModelState.IsValid) { ModelState.AddModelError("", MessageUI.ErrorMessage); return(View(model)); } var modelMap = Mapper.Map <BrandViewModel, Brand>(model); _brandService.Update(modelMap); Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.Brand))); if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\")) { return(RedirectToAction("Index")); } return(Redirect(returnUrl)); } catch (Exception ex) { ExtentionUtils.Log(string.Concat("Brand.Create: ", ex.Message)); return(View(model)); } }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { IEnumerable <MenuLink> menuLinks = from id in ids select this._menuLinkService.GetById(int.Parse(id)); this._menuLinkService.BatchDelete(menuLinks); //Delete localize for (int i = 0; i < ids.Length; i++) { IEnumerable <LocalizedProperty> ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); this._localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception ex) { ExtentionUtils.Log(string.Concat("MenuLink.Delete: ", ex.Message)); base.ModelState.AddModelError("", ex.Message); } return(base.RedirectToAction("Index")); }
public ActionResult Edit(AttributeValueViewModel attributeValue, string ReturnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { base.ModelState.AddModelError("", MessageUI.ErrorMessage); return(base.View(attributeValue)); } else { AttributeValue attributeValue1 = Mapper.Map <AttributeValueViewModel, AttributeValue>(attributeValue); this._attributeValueService.Update(attributeValue1); base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.AttributeValue))); if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); } else { action = this.Redirect(ReturnUrl); } } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("District.Edit: ", exception.Message)); return(base.View(attributeValue)); } return(action); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { List <Order> orders = new List <Order>(); List <OrderGallery> orderGalleries = new List <OrderGallery>(); string[] strArrays = ids; for (int i = 0; i < (int)strArrays.Length; i++) { int num = int.Parse(strArrays[i]); Order order = this._orderService.Get((Order x) => x.Id == num, false); orderGalleries.AddRange(order.OrderGalleries.ToList <OrderGallery>()); orders.Add(order); } this._galleryService.BatchDelete(orderGalleries); this._orderService.BatchDelete(orders); } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("Order.Delete: ", exception.Message)); } return(base.RedirectToAction("Index")); }
public ActionResult Edit(BrandViewModel BrandView, string ReturnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { base.ModelState.AddModelError("", MessageUI.ErrorMessage); return(base.View(BrandView)); } else { Brand Brand = Mapper.Map <BrandViewModel, Brand>(BrandView); this._BrandService.Update(Brand); base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.Brand))); if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); } else { action = this.Redirect(ReturnUrl); } } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("MailSetting.Create: ", exception.Message)); return(base.View(BrandView)); } return(action); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { var contactInformations = from id in ids select _contactInfoService.GetById(int.Parse(id)); _contactInfoService.BatchDelete(contactInformations); //Delete localize for (var i = 0; i < ids.Length; i++) { var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); _localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception exception1) { var exception = exception1; ExtentionUtils.Log(string.Concat("ContactInformation.Delete: ", exception.Message)); } return(RedirectToAction("Index")); }
public ActionResult Edit(ProvinceViewModel provinceView, string returnUrl) { ActionResult action; try { if (!ModelState.IsValid) { ModelState.AddModelError("", MessageUI.ErrorMessage); return(View(provinceView)); } var province = Mapper.Map <ProvinceViewModel, Province>(provinceView); _provinceService.Update(province); Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.Provinces))); if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\")) { action = RedirectToAction("Index"); } else { action = Redirect(returnUrl); } } catch (Exception exception1) { var exception = exception1; ExtentionUtils.Log(string.Concat("MailSetting.Create: ", exception.Message)); return(View(provinceView)); } return(action); }
public ActionResult Delete(int[] ids) { try { if (ids.Length != 0) { IEnumerable <News> news = from id in ids select this._newsService.GetById(id); this._newsService.BatchDelete(news); //Delete localize for (int i = 0; i < ids.Length; i++) { IEnumerable <LocalizedProperty> ieLocalizedProperty = _localizedPropertyService.GetLocalizedPropertyByEntityId(ids[i]); this._localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("Post.Delete: ", exception.Message)); } return(base.RedirectToAction("Index")); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { IEnumerable <StaticContent> staticContents = from id in ids select this._staticContentService.GetById(int.Parse(id)); this._staticContentService.BatchDelete(staticContents); ////Check and delete logo exists //string str1 = string.Format("{0}", item.FileName.NonAccent()); //if (System.IO.File.Exists(str)) // System.IO.File.Delete(str); //Delete localize for (int i = 0; i < ids.Length; i++) { IEnumerable <LocalizedProperty> ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); this._localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("Post.Delete: ", exception.Message)); } return(base.RedirectToAction("Index")); }
public ActionResult Edit(GenericControlValueViewModel model, string returnUrl) { ActionResult action; try { if (!ModelState.IsValid) { ModelState.AddModelError("", MessageUI.ErrorMessage); return(View(model)); } var modelMap = Mapper.Map <GenericControlValueViewModel, GenericControlValue>(model); _genericControlValueService.Update(modelMap); Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.Name))); if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\")) { action = RedirectToAction("Index"); } else { action = Redirect(returnUrl); } } catch (Exception exception1) { var exception = exception1; ExtentionUtils.Log(string.Concat("GenericControlValue.Edit: ", exception.Message)); return(View(model)); } return(action); }
public ActionResult Create(ProvinceViewModel province, string ReturnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { base.ModelState.AddModelError("", MessageUI.ErrorMessage); return(base.View(province)); } else { Province province1 = Mapper.Map <ProvinceViewModel, Province>(province); this._provinceService.Create(province1); base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.CreateSuccess, FormUI.Provinces))); if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); } else { action = this.Redirect(ReturnUrl); } } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("Province.Create: ", exception.Message)); return(base.View(province)); } return(action); }
public ActionResult Delete(int[] ids) { try { if (ids.Length != 0) { var numArray = ids; for (var i = 0; i < numArray.Length; i++) { var num = numArray[i]; var slideShow = _slideShowService.Get(x => x.Id == num); _slideShowService.Delete(slideShow); //Delete localize var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(num); _localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception ex) { ExtentionUtils.Log(string.Concat("SlideShow.Delete: ", ex.Message)); } return(RedirectToAction("Index")); }
public ActionResult Edit(PaymentMethodViewModel model, string returnUrl) { ActionResult action; try { if (!ModelState.IsValid) { ModelState.AddModelError("", MessageUI.ErrorMessage); return(View(model)); } var byId = _paymentMethodService.Get(x => x.Id == model.Id); if (model.Image != null && model.Image.ContentLength > 0) { var fileExtension = Path.GetExtension(model.Image.FileName); var fileNameOriginal = Path.GetFileNameWithoutExtension(model.Image.FileName); var fileName = fileNameOriginal.FileNameFormat(fileExtension); //var fileExtension = Path.GetExtension(model.Image.FileName); //var fileName = titleNonAccent.FileNameFormat(fileExtension); _imagePlugin.CropAndResizeImage(model.Image, $"{Contains.PaymentMethodFolder}", fileName, ImageSize.PaymentMethodWithMediumSize, ImageSize.PaymentMethodHeightMediumSize); model.ImageUrl = string.Concat(Contains.PaymentMethodFolder, fileName); } var modelMap = Mapper.Map(model, byId); _paymentMethodService.Update(modelMap); //Update Localized foreach (var localized in model.Locales) { _localizedPropertyService.SaveLocalizedValue(modelMap, x => x.PaymentMethodSystemName, localized.PaymentMethodSystemName, localized.LanguageId); _localizedPropertyService.SaveLocalizedValue(modelMap, x => x.Description, localized.Description, localized.LanguageId); } Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.PaymentMethod))); if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\")) { action = RedirectToAction("Index"); } else { action = Redirect(returnUrl); } } catch (Exception ex) { ExtentionUtils.Log(string.Concat("PaymentMethod.Edit: ", ex.Message)); return(View(model)); } return(action); }
public ActionResult Edit(SlideShowViewModel model, string ReturnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { String messages = String.Join(Environment.NewLine, ModelState.Values.SelectMany(v => v.Errors) .Select(v => v.ErrorMessage + " " + v.Exception)); base.ModelState.AddModelError("", messages); return(base.View(model)); } else { SlideShow slideShow = this._slideShowService.Get((SlideShow x) => x.Id == model.Id, false); if (model.Image != null && model.Image.ContentLength > 0) { string fileName = Path.GetFileName(model.Image.FileName); string extension = Path.GetExtension(model.Image.FileName); fileName = string.Concat(model.Title.NonAccent(), extension); string str = Path.Combine(base.Server.MapPath(string.Concat("~/", Contains.AdsFolder)), fileName); model.Image.SaveAs(str); model.ImgPath = string.Concat(Contains.AdsFolder, fileName); } SlideShow modelMap = Mapper.Map <SlideShowViewModel, SlideShow>(model, slideShow); this._slideShowService.Update(modelMap); //Update Localized foreach (var localized in model.Locales) { _localizedPropertyService.SaveLocalizedValue(modelMap, x => x.Title, localized.Title, localized.LanguageId); _localizedPropertyService.SaveLocalizedValue(modelMap, x => x.Description, localized.Description, localized.LanguageId); } base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.SlideShow))); if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); } else { action = this.Redirect(ReturnUrl); } } } catch (Exception exception1) { Exception exception = exception1; base.ModelState.AddModelError("", exception.Message); ExtentionUtils.Log(string.Concat("SlideShow.Edit: ", exception.Message)); return(base.View(model)); } return(action); }
public async Task <ActionResult> Edit(RegisterFormViewModel model, string ReturnUrl) { ActionResult action; try { model.Created = null; IdentityUser identityUser = _userManager.FindById(model.Id); identityUser = Mapper.Map(model, identityUser); IdentityResult identityResult = await this._userManager.UpdateAsync(identityUser); if (identityResult.Succeeded) { if (model.IsSuperAdmin) { IList <string> roles = this._userManager.GetRoles(model.Id); this._userManager.RemoveFromRoles <IdentityUser, Guid>(model.Id, roles.ToArray <string>()); } else { string item = this.Request["roles"]; if (!string.IsNullOrEmpty(item)) { IList <string> lstUserRole = this._userManager.GetRoles(model.Id); _userManager.RemoveFromRoles(model.Id, lstUserRole.ToArray()); string[] strArrays = item.Split(new char[] { ',' }); this._userManager.AddToRoles(model.Id, strArrays); } } Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.Account))); if (!this.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = this.RedirectToAction("Index"); return(action); } else { action = this.Redirect(ReturnUrl); return(action); } } else { this.AddErrors(identityResult); action = this.View(model); return(action); } } catch (Exception exception1) { Exception exception = exception1; ExtentionUtils.Log(string.Concat("Account.Update: ", exception.Message)); } action = this.View(); return(action); }
public ActionResult Edit(BannerViewModel model, string returnUrl) { ActionResult action; try { if (!ModelState.IsValid) { ModelState.AddModelError("", MessageUI.ErrorMessage); return(View(model)); } var byId = _bannerService.GetById(model.Id); if (model.Image != null && model.Image.ContentLength > 0) { var folderName = Utils.FolderName(model.Title); var fileNameOriginal = Path.GetFileNameWithoutExtension(model.Image.FileName); var fileExtension = Path.GetExtension(model.Image.FileName); var fileName = fileNameOriginal.FileNameFormat(fileExtension); _imagePlugin.CropAndResizeImage(model.Image, $"{Contains.AdsFolder}{folderName}/", fileName, ImageSize.BannerWithBigSize, ImageSize.BannerHeightBigSize, true); model.ImgPath = $"{Contains.AdsFolder}{folderName}/{fileName}"; //var fileName = Path.GetFileName(model.Image.FileName); //var extension = Path.GetExtension(model.Image.FileName); ////fileName = string.Concat(model.FullName.NonAccent(""), extension); //var str = Path.Combine(Server.MapPath(string.Concat("~/", Contains.AdsFolder)), fileName); //model.Image.SaveAs(str); //model.ImgPath = string.Concat(Contains.AdsFolder, fileName); } var banner = Mapper.Map(model, byId); _bannerService.Update(banner); Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.Banner))); if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\")) { action = RedirectToAction("Index"); } else { action = Redirect(returnUrl); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); ExtentionUtils.Log(string.Concat("Banner.Edit: ", ex.Message)); return(View(model)); } return(action); }
public ActionResult Edit(FlowStepViewModel model, string ReturnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { base.ModelState.AddModelError("", MessageUI.ErrorMessage); return(base.View(model)); } else { FlowStep byId = this._flowStepService.Get((FlowStep x) => x.Id == model.Id, false); string titleNonAccent = model.Title.NonAccent(); if (model.Image != null && model.Image.ContentLength > 0) { string fileExtension = Path.GetExtension(model.Image.FileName); string fileName1 = titleNonAccent.FileNameFormat(fileExtension); // int? nullable = null; //int? nullable1 = nullable; //nullable = null; this._imagePlugin.CropAndResizeImage(model.Image, string.Format("{0}", Contains.FlowStepFolder), fileName1, ImageSize.FlowStep_WithMediumSize, ImageSize.FlowStep_HeightMediumSize, false); model.ImageUrl = string.Concat(Contains.FlowStepFolder, fileName1); } FlowStep flowStep1 = Mapper.Map(model, byId); _flowStepService.Update(flowStep1); base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.FlowStep))); if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); } else { action = this.Redirect(ReturnUrl); } } } catch (Exception exception1) { Exception exception = exception1; base.ModelState.AddModelError("", exception.Message); ExtentionUtils.Log(string.Concat("Post.Edit: ", exception.Message)); return(base.View(model)); } return(action); }
public ActionResult Create(LanguageFormViewModel model, string returnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { String messages = String.Join(Environment.NewLine, ModelState.Values.SelectMany(v => v.Errors) .Select(v => v.ErrorMessage + " " + v.Exception)); base.ModelState.AddModelError("", messages); return(base.View(model)); } else { if (model.File != null && model.File.ContentLength > 0) { string fileName = Path.GetFileName(model.File.FileName); string extension = Path.GetExtension(model.File.FileName); //image = string.Concat(image.NonAccent(), extension); string str = Path.Combine(base.Server.MapPath(string.Concat("~/", Contains.FolderLanguage)), fileName); model.File.SaveAs(str); model.Flag = string.Concat(Contains.FolderLanguage, fileName); } Language modelMap = Mapper.Map <LanguageFormViewModel, Language>(model); this._langService.CreateLanguage(modelMap); if (this._langService.SaveLanguage() > 0) { base.Response.Cookies.Add(new HttpCookie("system_message", MessageUI.SuccessLanguage)); if (!base.Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); return(action); } else { action = this.Redirect(returnUrl); return(action); } } } base.ModelState.AddModelError("", MessageUI.ErrorMessage); return(base.View(model)); } catch (Exception ex) { ExtentionUtils.Log(string.Concat("Language.Create: ", ex.Message)); return(View(model)); } return(action); }