public ActionResult Create(BrandViewModel brandViewModel) { if (ModelState.IsValid) { Mapper.CreateMap<BrandViewModel, Brand>(); Brand brand = Mapper.Map<BrandViewModel, Brand>(brandViewModel); var result = _brandBusiness.ValidateBrand(brand, "I"); if (!string.IsNullOrEmpty(result)) { ModelState.AddModelError("", result); return View(brandViewModel); } //int vid = _versionDataBusiness.GetUnpublishedVersion(); //if (vid == 0) //{ // ModelState.AddModelError("", "New unpublished version not detected. Can not proceed. Create new version with out publishing it and try again."); // TempData["Success"] = "New unpublished version not detected. Can not proceed. Create new version with out publishing it and try again."; // TempData["isSuccess"] = "false"; // return RedirectToAction("Index"); //} else { brand.EncId = Md5Encryption.Encrypt(brand.BrandId.ToString()); bool isSuccess = _brandBusiness.AddUpdateDeleteBrand(brand, "I"); if (isSuccess) { TempData["Success"] = "Brand Created Successfully!!"; TempData["isSuccess"] = "true"; return RedirectToAction("Index"); } else { TempData["Success"] = "Failed to create Brand!!"; TempData["isSuccess"] = "false"; } } } return View(brandViewModel); }
public ActionResult Create() { BrandViewModel brandViewModel = new BrandViewModel(); return View(brandViewModel); }