/// <summary> /// /// </summary> /// <param name="gaurdViewModel"></param> /// <returns></returns> public int? CreateUpdateGuard(GuardViewModel gaurdViewModel) { Guard guard = null; if (gaurdViewModel.GuardId > 0) { guard = _repository.Find<Guard>(x => x.GuardId == gaurdViewModel.GuardId); if (guard == null) return null; guard.Name = gaurdViewModel.Name; guard.SSN = gaurdViewModel.SSN; guard.Address = gaurdViewModel.Address; guard.ContactNo = gaurdViewModel.ContactNo; guard.HourlyRate = gaurdViewModel.HourlyRate; guard.Comments = gaurdViewModel.Comments; guard.Zip = gaurdViewModel.Zip; guard.ModifiedBy = gaurdViewModel.ModifiedBy; guard.ModifiedDate= DateTime.Now; _repository.Modify<Guard>(guard); return guard.GuardId; } Mapper.CreateMap<GuardViewModel, Guard>(); guard = Mapper.Map<GuardViewModel, Guard>(gaurdViewModel); guard.CreatedDate = DateTime.Now; guard.CreatedBy = gaurdViewModel.CreatedBy; guard.Active= true; guard.IsDeleted = false; return _repository.Insert<Guard>(guard); }
public ActionResult CreateUpdateGuard(GuardViewModel guardViewModel) { ActiveUser activeUser = new JavaScriptSerializer().Deserialize<ActiveUser>(System.Web.HttpContext.Current.User.Identity.Name); guardViewModel.CreatedBy = activeUser.UserId; guardViewModel.ModifiedBy = activeUser.UserId; var result = _gaurdComponent.CreateUpdateGuard(guardViewModel); return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult CreateUpdateGuardPopup(int id) { var guard = _gaurdComponent.GetGaurd(id); if (guard == null) guard = new GuardViewModel(); return PartialView("/Views/Shared/Partials/_Guard.cshtml", guard); }
public ActionResult GuardPaymentReport() { GuardViewModel objectGuardViewModel = new GuardViewModel(); objectGuardViewModel.Guardlist = new SelectList(_guardComponent.GetAllGaurd(), "GuardId", "NameSSN"); return View(objectGuardViewModel); }