public async Task <IActionResult> Edit(int id, [Bind("RefPartnerTypeId,PartnerTypeCode,PartnerType")] RefPartnerType refPartnerType) { if (id != refPartnerType.RefPartnerTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(refPartnerType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RefPartnerTypeExists(refPartnerType.RefPartnerTypeId)) { return(NotFound()); } else { throw; } } TempData["messageType"] = "success"; TempData["messageTitle"] = "RECORD UPDATED"; TempData["message"] = "Record successfully updated"; return(RedirectToAction(nameof(Index))); } return(View(refPartnerType)); }
public async Task <IActionResult> Create([Bind("RefPartnerTypeId,PartnerTypeCode,PartnerType")] RefPartnerType refPartnerType) { if (ModelState.IsValid) { _context.Add(refPartnerType); await _context.SaveChangesAsync(); TempData["messageType"] = "success"; TempData["messageTitle"] = "RECORD CREATED"; TempData["message"] = "New record successfully created"; return(RedirectToAction(nameof(Index))); } return(View(refPartnerType)); }
private void btnUpdate_Click(object sender, EventArgs e) { try { var PartnerTypeToUpdate = new RefPartnerType(); if (PartnerTypeToUpdate == null) { MessageBox.Show("Aucun type sélectionnée, l'opération ne peut continuer"); } else { KoloContextHelper.Context.UpdateObject(PartnerTypeToUpdate); KoloContextHelper.Context.SaveChanges(); MessageBox.Show("Mise a jour effectueer avec success!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }