public ActionResult AddAbsentOrLate(AbsentOrLate absentOrLate) { if(absentOrLate.PETianoId == 0) { ViewBag.PETianos = _PETianoService.GetPETianos().Select(petiano => new SelectListItem { Text = petiano.Name + "(" + petiano.Login + ")", Value = petiano.Id.ToString() }); return View(absentOrLate); } AbsentOrLate temp = _AbsentOrLateService.GetAbsentOrLate(new AbsentOrLateFilter() { PETianoId = absentOrLate.PETianoId, RecorfOfMeetingId = absentOrLate.RecordOfMeetingId }); if (temp != null) { absentOrLate.Id = temp.Id; _AbsentOrLateService.EditAbsentOrLate(absentOrLate); } else { _AbsentOrLateService.CreateAbsentOrLate(absentOrLate); } return RedirectToAction("Index"); }
public void EditAbsentOrLate(AbsentOrLate absentOrLate) { using (IDataProvider provider = base.CreateDataProvider()) using (IAbsentOrLateRepository repository = provider.CreateAbsentOrLateRepository()) repository.Update(absentOrLate); }
public ActionResult RemoveAbsentOrLate(AbsentOrLate absentOrLate) { absentOrLate = _AbsentOrLateService.GetAbsentOrLate(new AbsentOrLateFilter() { Id = absentOrLate.Id }); _AbsentOrLateService.DeleteAbsentOrLate(absentOrLate); return RedirectToAction("Index"); }
public void EditAbsentOrLate(AbsentOrLate absentOrLate) { using (IBusinessProvider provider = base.CreateBusinessProvider()) using (IAbsentOrLateBusinessProvider prov = provider.CreateAbsentOrLateBusinessProvider()) prov.EditAbsentOrLate(absentOrLate); }