public ActionResult Create(ObjectAttributeViewModel model) { if (ModelState.IsValid) { var ObjectAttribute = new Domain.Sale.Entities.ObjectAttribute(); AutoMapper.Mapper.Map(model, ObjectAttribute); ObjectAttribute.IsDeleted = false; ObjectAttribute.CreatedUserId = WebSecurity.CurrentUserId; ObjectAttribute.ModifiedUserId = WebSecurity.CurrentUserId; ObjectAttribute.CreatedDate = DateTime.Now; ObjectAttribute.ModifiedDate = DateTime.Now; ObjectAttributeRepository.InsertObjectAttribute(ObjectAttribute); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Edit(int?Id) { var ObjectAttribute = ObjectAttributeRepository.GetObjectAttributeById(Id.Value); if (ObjectAttribute != null && ObjectAttribute.IsDeleted != true) { var model = new ObjectAttributeViewModel(); AutoMapper.Mapper.Map(ObjectAttribute, model); //if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1) //{ // TempData["FailedMessage"] = "NotOwner"; // return RedirectToAction("Index"); //} return(View(model)); } if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.AbsoluteUri)); } return(RedirectToAction("Index")); }
public ActionResult Edit(ObjectAttributeViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var ObjectAttribute = ObjectAttributeRepository.GetObjectAttributeById(model.Id); AutoMapper.Mapper.Map(model, ObjectAttribute); ObjectAttribute.ModifiedUserId = WebSecurity.CurrentUserId; ObjectAttribute.ModifiedDate = DateTime.Now; ObjectAttributeRepository.UpdateObjectAttribute(ObjectAttribute); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess; return(RedirectToAction("Index")); } return(View(model)); } return(View(model)); //if (Request.UrlReferrer != null) // return Redirect(Request.UrlReferrer.AbsoluteUri); //return RedirectToAction("Index"); }
public ViewResult Create() { var model = new ObjectAttributeViewModel(); return(View(model)); }