public DailyLog() { this.InitializeComponent(); //ViewModel = new DailyLogViewModel(DateTime.Now); _bulletRepository = new BulletRepository(); ViewModel = new DailyLogViewModel(_bulletRepository); }
public int?CreateUpdateDailyLog(DailyLogViewModel dailyLogViewModel) { DailyLog dailyLog = null; if (dailyLogViewModel.DailyLogId > 0) { dailyLog = _repository.Find <DailyLog>(x => x.DailyLogId == dailyLogViewModel.DailyLogId); if (dailyLog == null) { return(null); } dailyLog.CustomerId = dailyLogViewModel.CustomerId; dailyLog.GuardId = dailyLogViewModel.GuardId; dailyLog.Comments = dailyLogViewModel.Comments; dailyLog.Dated = dailyLogViewModel.Dated; _repository.Modify <DailyLog>(dailyLog); return(dailyLog.CustomerId); } Mapper.CreateMap <DailyLogViewModel, DailyLog>(); dailyLog = Mapper.Map <DailyLogViewModel, DailyLog>(dailyLogViewModel); dailyLog.CreatedDate = DateTime.Now; dailyLog.Dated = dailyLogViewModel.Dated; dailyLog.IsDeleted = false; return(_repository.Insert <DailyLog>(dailyLog)); }
public ActionResult CreateUpdateDailyLog(DailyLogViewModel dailylogViewModel) { ActiveUser activeUser = new JavaScriptSerializer().Deserialize <ActiveUser>(System.Web.HttpContext.Current.User.Identity.Name); dailylogViewModel.CreatedBy = activeUser.UserId; dailylogViewModel.ModifiedBy = activeUser.UserId; var result = _dailylogComponent.CreateUpdateDailyLog(dailylogViewModel); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult CreateUpdateDailyLogPopup(int id) { var dailylog = _dailylogComponent.GetDailyLog(id); var customerList = _dailylogComponent.GetAllCustomer(); var guardlist = _dailylogComponent.GetAllGuard(); if (dailylog == null) { dailylog = new DailyLogViewModel(); } dailylog.CustomerList = new SelectList(_dailylogComponent.GetAllCustomer(), "CustomerId", "NameEmail"); dailylog.GuardList = new SelectList(_dailylogComponent.GetAllGuard(), "GuardId", "NameSSN"); return(PartialView("/Views/Shared/Partials/_DailyLog.cshtml", dailylog)); }