public async Task <IActionResult> Edit(int id, TipPlata tipPlata) { if (id != tipPlata.TipPlataId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.TipPlati.Update(tipPlata); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TipPlataExists(tipPlata.TipPlataId)) { return(NotFound()); } else { throw; } } TempData["Message"] = "Tip plata actualizat cu succes!"; TempData["Success"] = "true"; return(RedirectToAction(nameof(Index))); } return(PartialView("_EditTipPlata", tipPlata)); }
public async Task <IActionResult> Create(TipPlata tipPlata) { if (ModelState.IsValid) { _context.TipPlati.Add(tipPlata); await _context.SaveChangesAsync(); TempData["Message"] = "Tip plata adaugat cu succes!"; TempData["Success"] = "true"; return(RedirectToAction(nameof(Index))); } return(PartialView("_AddTipPlata", tipPlata)); }