public HttpResponseMessage Update(Identity id, TopicPut topic) { //todo id?mmm return(ProcessPut(() => { var instance = topic.ToModel(); updateGroupCommand.Execute(instance); })); }
public ActionResult Edit(EditTopicModel model) { if (!ModelState.IsValid) { return(View(model)); } var entity = entityById.Get <Topic>((Identity)model.TopicId); ModelToEntity(model, entity); updateTopicCommand.Execute(entity); return(RedirectToAction("Index")); }
public IActionResult Put(int id, [FromQuery] TopicDto dto) { try { _updateCommand.Execute(dto); return(NoContent()); } catch (EntityNotFoundException) { return(NotFound()); } catch (Exception) { return(StatusCode(500, "An error has occured")); } }
public ActionResult Edit(int id, TopicDto dto) { if (!ModelState.IsValid) { return(View(dto)); } try { _editCommand.Execute(dto); return(RedirectToAction(nameof(Index))); } catch (EntityNotFoundException) { TempData["error"] = "This Topic doesnt exist"; return(RedirectToAction(nameof(Index))); } catch (EntityAlreadyExistsException) { TempData["error"] = "Topic already exists"; return(View(dto)); } }