public void UpdateServerTimeEntry(ServerTimeEntry entity, bool applyProgramEditToAllEntries = false) { _serverTimeEntryRepoitory.Update(entity); if (applyProgramEditToAllEntries) { _serverTimeEntryRepoitory.BatchUpdate(t => (t.ServerId == entity.ServerId && t.PaySourceId == entity.PaySourceId) , t => new ServerTimeEntry() { ProgramId = entity.ProgramId }); } _unitOfWork.Commit(); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServerTimeEntry entity = _serverTimeEntryService.GetById(id.Value); if (entity == null) { return(HttpNotFound()); } var viewmodel = Mapper.Map <ServerTimeEntry, ServerTimeEntryDetailsViewModel>(entity); return(View(viewmodel)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServerTimeEntry entity = _serverTimeEntryService.GetById(id.Value); if (entity == null) { return(HttpNotFound()); } var viewmodel = Mapper.Map <ServerTimeEntry, ServerTimeEntryEditViewModel>(entity); viewmodel.SelectedServers = _serverService.GetServers().Select(t => new SelectListItem() { Text = t.FullName, Value = t.Id.ToString() }); var paysourceList = _paySourceService.GetPaySources(); viewmodel.SelectedPaySources = paysourceList.Select(t => new SelectListItem() { Text = t.Description, Value = t.Id.ToString() }); viewmodel.SelectedPrograms = paysourceList.FirstOrDefault(t => t.Id == entity.PaySourceId).Programs.Select(t => new SelectListItem() { Text = t.Name, Value = t.Id.ToString() }); return(View(viewmodel)); }
public void AddServerTimeEntry(ServerTimeEntry entity) { _serverTimeEntryRepoitory.Add(entity); _unitOfWork.Commit(); }
public bool TimeEntryExists(ServerTimeEntry entity) { return(_serverTimeEntryRepoitory.TimeEntryExists(entity)); }
public void Remove(ServerTimeEntry entity) { _serverTimeEntryRepoitory.Delete(entity); _unitOfWork.Commit(); }