public ActionResult Create(Pacjent pacjenci) { try { if (ModelState.IsValid) { pacjentRepository.InsertPacjent(pacjenci); pacjentRepository.Save(); return RedirectToAction("Index"); } } catch (DataException) { //Log the error (add a variable name after DataException) ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return View(pacjenci); }
public void UpdatePacjent(Pacjent pacjent) { context.Entry(pacjent).State = EntityState.Modified; }
public void InsertPacjent(Pacjent pacjent) { context.Pacjenci.Add(pacjent); }