public async Task <IActionResult> Create([Bind("PacijentId,DatumOtvaranjaKartona,PosjedovanjeLoyalKartice")] StomatoloskiKarton stomatoloskiKarton) { if (ModelState.IsValid) { _context.Add(stomatoloskiKarton); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(stomatoloskiKarton)); }
// GET: StomatoloskiKarton/Create public async Task <IActionResult> Create(int?id) { if (id == null || id < 0) { return(NotFound()); } StomatoloskiKarton stKarton = new StomatoloskiKarton(); stKarton.PacijentId = Convert.ToInt32(id); //List<StomatoloskiKarton> kartoni = await _context.StomatoloskiKarton.ToListAsync(); return(View(stKarton)); }
public async Task <IActionResult> ProvjeriKarton(int?id) { if (id == null || id < 0) { throw new Exception(); } StomatoloskiKarton stKarton = await _context.StomatoloskiKarton.FirstOrDefaultAsync(m => m.PacijentId == id); if (stKarton == null) { return(RedirectToAction("Create", new { id = id })); } else { return(RedirectToAction("EditForPacijent", new { id = id })); } }
public async Task <IActionResult> EditForPacijent(StomatoloskiKarton stomatoloskiKarton) { if (ModelState.IsValid) { try { _context.Update(stomatoloskiKarton); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StomatoloskiKartonExists(stomatoloskiKarton.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(stomatoloskiKarton)); }