// Called from Index (only id) or Edit (id and delete) view public ActionResult Edit(int?id, bool?delete) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IPacjentService service = new PacjentService(); PacjentModel pacjent = new PacjentModel(); pacjent = service.GetPacjentById(id.Value); if (pacjent == null) { return(HttpNotFound()); } if (delete.HasValue) { service.DeletePacjent(pacjent); return(RedirectToAction("Index")); } return(View(pacjent)); }
public PacjentModel GetPacjentById(int pacjentId) { IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>(); PacjentModel pacjent = pacjentRepository.FindById(pacjentId); return(pacjent); }
public void DeletePacjentById(int pacjentId) { IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>(); PacjentModel pacjent = pacjentRepository.FindById(pacjentId); pacjentRepository.Delete(pacjent); }
public ActionResult Edit(PacjentModel pacjent) { if (ModelState.IsValid) { IPacjentService service = new PacjentService(); service.EditPacjent(pacjent); return(RedirectToAction("Index")); } return(View(pacjent)); }
public void DeletePacjent(PacjentModel pacjent) { IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>(); pacjentRepository.Delete(pacjent); }
public void EditPacjent(PacjentModel pacjent) { IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>(); pacjentRepository.Update(pacjent); }
public void AddPacjent(PacjentModel pacjent) { IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>(); pacjentRepository.Add(pacjent); }