// GET: /ProductMaster/Create public ActionResult Create() { SalesTaxGroupParty vm = new SalesTaxGroupParty(); vm.IsActive = true; return(View("Create", vm)); }
// GET: /ProductMaster/Edit/5 public ActionResult Edit(int id) { SalesTaxGroupParty pt = _SalesTaxGroupPartyService.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)); } SalesTaxGroupParty SalesTaxGroupParty = _SalesTaxGroupPartyService.Find(id); if (SalesTaxGroupParty == null) { return(HttpNotFound()); } ReasonViewModel vm = new ReasonViewModel() { id = id, }; return(PartialView("_Reason", vm)); }
public ActionResult Post(SalesTaxGroupParty vm) { SalesTaxGroupParty pt = vm; if (ModelState.IsValid) { if (vm.SalesTaxGroupPartyId <= 0) { pt.CreatedDate = DateTime.Now; pt.ModifiedDate = DateTime.Now; pt.CreatedBy = User.Identity.Name; pt.ModifiedBy = User.Identity.Name; pt.ObjectState = Model.ObjectState.Added; _SalesTaxGroupPartyService.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.SalesTaxGroupParty).DocumentTypeId, DocId = pt.SalesTaxGroupPartyId, ActivityType = (int)ActivityTypeContants.Added, })); return(RedirectToAction("Create").Success("Data saved successfully")); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); SalesTaxGroupParty temp = _SalesTaxGroupPartyService.Find(pt.SalesTaxGroupPartyId); SalesTaxGroupParty ExRec = Mapper.Map <SalesTaxGroupParty>(temp); temp.SalesTaxGroupPartyName = pt.SalesTaxGroupPartyName; temp.IsActive = pt.IsActive; temp.ModifiedDate = DateTime.Now; temp.ModifiedBy = User.Identity.Name; temp.ObjectState = Model.ObjectState.Modified; _SalesTaxGroupPartyService.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.SalesTaxGroupParty).DocumentTypeId, DocId = temp.SalesTaxGroupPartyId, ActivityType = (int)ActivityTypeContants.Modified, xEModifications = Modifications, })); return(RedirectToAction("Index").Success("Data saved successfully")); } } return(View("Create", vm)); }
public SalesTaxGroupParty Add(SalesTaxGroupParty pt) { _unitOfWork.Repository <SalesTaxGroupParty>().Insert(pt); return(pt); }
public void Update(SalesTaxGroupParty pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <SalesTaxGroupParty>().Update(pt); }
public void Delete(SalesTaxGroupParty pt) { _unitOfWork.Repository <SalesTaxGroupParty>().Delete(pt); }
public SalesTaxGroupParty Create(SalesTaxGroupParty pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <SalesTaxGroupParty>().Insert(pt); return(pt); }