// GET: /SalesTaxProductCodeMaster/Create public ActionResult Create() { SalesTaxProductCode vm = new SalesTaxProductCode(); vm.IsActive = true; return(View("Create", vm)); }
// GET: /ProductMaster/Edit/5 public ActionResult Edit(int id) { SalesTaxProductCode pt = _SalesTaxProductCodeService.Find(id); if (pt == null) { return(HttpNotFound()); } return(View("Create", pt)); }
// GET: /ProductMaster/Delete/5 public ActionResult Delete(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SalesTaxProductCode SalesTaxProductCode = db.SalesTaxProductCode.Find(id); if (SalesTaxProductCode == null) { return(HttpNotFound()); } ReasonViewModel vm = new ReasonViewModel() { id = id, }; return(PartialView("_Reason", vm)); }
public void Update(SalesTaxProductCode pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <SalesTaxProductCode>().Update(pt); }
public void Delete(SalesTaxProductCode pt) { _unitOfWork.Repository <SalesTaxProductCode>().Delete(pt); }
public SalesTaxProductCode Create(SalesTaxProductCode pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <SalesTaxProductCode>().Insert(pt); return(pt); }
public SalesTaxProductCode Add(SalesTaxProductCode pt) { _unitOfWork.Repository <SalesTaxProductCode>().Insert(pt); return(pt); }
public ActionResult Post(SalesTaxProductCode vm) { SalesTaxProductCode pt = vm; if (ModelState.IsValid) { if (vm.SalesTaxProductCodeId <= 0) { pt.CreatedDate = DateTime.Now; pt.ModifiedDate = DateTime.Now; pt.CreatedBy = User.Identity.Name; pt.ModifiedBy = User.Identity.Name; pt.ObjectState = Model.ObjectState.Added; _SalesTaxProductCodeService.Create(pt); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("Create", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.SalesTaxProductCode).DocumentTypeId, DocId = pt.SalesTaxProductCodeId, ActivityType = (int)ActivityTypeContants.Added, })); return(RedirectToAction("Create").Success("Data saved successfully")); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); SalesTaxProductCode temp = _SalesTaxProductCodeService.Find(pt.SalesTaxProductCodeId); SalesTaxProductCode ExRec = Mapper.Map <SalesTaxProductCode>(temp); temp.Code = pt.Code; temp.Description = pt.Description; temp.IsActive = pt.IsActive; temp.ModifiedDate = DateTime.Now; temp.ModifiedBy = User.Identity.Name; temp.ObjectState = Model.ObjectState.Modified; _SalesTaxProductCodeService.Update(temp); LogList.Add(new LogTypeViewModel { ExObj = ExRec, Obj = temp, }); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("Create", pt)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.SalesTaxProductCode).DocumentTypeId, DocId = temp.SalesTaxProductCodeId, ActivityType = (int)ActivityTypeContants.Modified, xEModifications = Modifications, })); return(RedirectToAction("Index").Success("Data saved successfully")); } } return(View("Create", vm)); }