// GET: /ProductMaster/Create public ActionResult Create() { PersonContactType vm = new PersonContactType(); vm.IsActive = true; return(View("Create", vm)); }
public static PersonContact Create( PersonContactType personContactType, string value) { return(new PersonContact( personContactType, value)); }
private PersonContact( PersonContactType personContactType, string value) { // ReSharper disable once VirtualMemberCallInConstructor PersonContactType = personContactType; Value = value; }
// GET: /ProductMaster/Edit/5 public ActionResult Edit(int id) { PersonContactType pt = _PersonContactTypeService.Find(id); if (pt == null) { return(HttpNotFound()); } return(View("Create", pt)); }
public void UpdatePersonContact(int id, PersonContactType personContactType, string value) { var contact = PersonContacts .FirstOrDefault( x => x.Id == id && !x.IsDeleted); if (contact == null) { throw new NotFoundException( StringResource.Contact, StringResource.Id, id); } contact.Update(personContactType, value); }
// GET: /ProductMaster/Delete/5 public ActionResult Delete(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonContactType PersonContactType = _PersonContactTypeService.Find(id); if (PersonContactType == null) { return(HttpNotFound()); } ReasonViewModel vm = new ReasonViewModel() { id = id, }; return(PartialView("_Reason", vm)); }
public void Update(PersonContactType personContactType, string value) { PersonContactType = personContactType; Value = value; }
public ActionResult Post(PersonContactType vm) { PersonContactType pt = vm; if (ModelState.IsValid) { if (vm.PersonContactTypeId <= 0) { pt.CreatedDate = DateTime.Now; pt.ModifiedDate = DateTime.Now; pt.CreatedBy = User.Identity.Name; pt.ModifiedBy = User.Identity.Name; pt.ObjectState = Model.ObjectState.Added; _PersonContactTypeService.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.PersonContactType).DocumentTypeId, DocId = pt.PersonContactTypeId, ActivityType = (int)ActivityTypeContants.Added, })); return(RedirectToAction("Create").Success("Data saved successfully")); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); PersonContactType temp = _PersonContactTypeService.Find(pt.PersonContactTypeId); PersonContactType ExRec = Mapper.Map <PersonContactType>(temp); temp.PersonContactTypeName = pt.PersonContactTypeName; temp.IsActive = pt.IsActive; temp.ModifiedDate = DateTime.Now; temp.ModifiedBy = User.Identity.Name; temp.ObjectState = Model.ObjectState.Modified; _PersonContactTypeService.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.PersonContactType).DocumentTypeId, DocId = temp.PersonContactTypeId, ActivityType = (int)ActivityTypeContants.Modified, xEModifications = Modifications, })); return(RedirectToAction("Index").Success("Data saved successfully")); } } return(View("Create", vm)); }
public PersonContactType Add(PersonContactType pt) { _unitOfWork.Repository <PersonContactType>().Insert(pt); return(pt); }
public void Update(PersonContactType pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <PersonContactType>().Update(pt); }
public void Delete(PersonContactType pt) { _unitOfWork.Repository <PersonContactType>().Delete(pt); }
public PersonContactType Create(PersonContactType pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <PersonContactType>().Insert(pt); return(pt); }