public IActionResult Update([FromBody] MuscularGroup muscularGroup) { try { var result = _muscularGroupsService.UpdateMuscularGroup(muscularGroup); return(new OkObjectResult(result)); // MuscularGroup } catch (Exception exception) { return(BadRequest(new WebApiException("Error", exception))); } }
public IActionResult Edit(MuscularGroupViewModel viewModel) { if (ModelState.IsValid && viewModel.Id > 0) { // Verify not exist on id var key = new MuscularGroupKey() { Id = viewModel.Id }; var muscularGroup = _muscularGroupsService.GetMuscularGroup(key); if (muscularGroup != null) { muscularGroup.Name = viewModel.Name; muscularGroup = _muscularGroupsService.UpdateMuscularGroup(muscularGroup); return(RedirectToAction("Index")); } } return(View(viewModel)); }