// GET: /ChargeGroupProductMaster/Create public ActionResult Create() { ChargeGroupProduct vm = new ChargeGroupProduct(); vm.IsActive = true; return(View("Create", vm)); }
// GET: /ProductMaster/Edit/5 public ActionResult Edit(int id) { ChargeGroupProduct pt = _ChargeGroupProductService.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)); } ChargeGroupProduct ChargeGroupProduct = db.ChargeGroupProduct.Find(id); if (ChargeGroupProduct == null) { return(HttpNotFound()); } ReasonViewModel vm = new ReasonViewModel() { id = id, }; return(PartialView("_Reason", vm)); }
public ActionResult Post(ChargeGroupProduct pt) { if (ModelState.IsValid) { if (pt.ChargeGroupProductId <= 0) { pt.CreatedDate = DateTime.Now; pt.ModifiedDate = DateTime.Now; pt.CreatedBy = User.Identity.Name; pt.ModifiedBy = User.Identity.Name; pt.ObjectState = Model.ObjectState.Added; _ChargeGroupProductService.Create(pt); ActivityLog log = new ActivityLog() { ActivityType = (int)(ActivityTypeContants.Added), CreatedBy = User.Identity.Name, CreatedDate = DateTime.Now, DocId = pt.ChargeGroupProductId, Narration = "A new ChargeGroupProduct is created with the Id " + pt.ChargeGroupProductId, }; try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("Create", pt)); } return(RedirectToAction("Create").Success("Data saved successfully")); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); ChargeGroupProduct temp = _ChargeGroupProductService.Find(pt.ChargeGroupProductId); ChargeGroupProduct ExRec = Mapper.Map <ChargeGroupProduct>(temp); temp.ChargeGroupProductName = pt.ChargeGroupProductName; temp.IsActive = pt.IsActive; temp.ModifiedDate = DateTime.Now; temp.ModifiedBy = User.Identity.Name; temp.ObjectState = Model.ObjectState.Modified; _ChargeGroupProductService.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(new DocumentTypeService(_unitOfWork).Find(MasterDocTypeConstants.ChargeGroupProduct).DocumentTypeId, //temp.ChargeGroupProductId, //null, //(int)ActivityTypeContants.Modified, //"", //User.Identity.Name, temp.ChargeGroupProductName, Modifications); LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.ChargeGroupProduct).DocumentTypeId, DocId = temp.ChargeGroupProductId, ActivityType = (int)ActivityTypeContants.Modified, xEModifications = Modifications, })); return(RedirectToAction("Index").Success("Data saved successfully")); } } return(View("Create", pt)); }
public ChargeGroupProduct Add(ChargeGroupProduct pt) { _unitOfWork.Repository <ChargeGroupProduct>().Insert(pt); return(pt); }
public void Update(ChargeGroupProduct pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <ChargeGroupProduct>().Update(pt); }
public void Delete(ChargeGroupProduct pt) { _unitOfWork.Repository <ChargeGroupProduct>().Delete(pt); }
public ChargeGroupProduct Create(ChargeGroupProduct pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <ChargeGroupProduct>().Insert(pt); return(pt); }