public async Task <IActionResult> Edit(int id, TypesMessage typesMessage) { if (id != typesMessage.Id) { ViewBag.ErrorMessage = "لايوجد بيانات"; return(View("NotFound")); } if (ModelState.IsValid) { try { _repository.Update <TypesMessage>(typesMessage); await _repository.SavaAll(); } catch (DbUpdateConcurrencyException) { if (_repository.GetTypesMessage(typesMessage.Id) == null) { ViewBag.ErrorMessage = "لايوجد بيانات"; return(View("NotFound")); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(typesMessage)); }
/// <summary> /// Create a new Example /// </summary> public Example() { Log = new LogMessage(); Structures = new StructuresMessage(); Binary = new BinaryMessage(); Types = new TypesMessage(); }
public async Task <IActionResult> Create(TypesMessage typesMessage) { if (ModelState.IsValid) { _repository.Add <TypesMessage>(typesMessage); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(typesMessage)); }