public async Task <IFormResult <ContentType> > UpdateItem(ContentType contentType) { ParseContentTypeField(contentType); contentType = _contentTypeRepository.UpdateContentType(contentType); if (contentType == null) { return new FormResult <ContentType>() { IsSucceeded = false, ErrorMessage = "Unable to update the ContentType" } } ; var result = new FormResult <ContentType>(contentType) { IsSucceeded = true, SuccessMessage = "ContentType has been updated" }; return(await Task.FromResult(result)); }
public IActionResult UpdateContentType([FromBody] ContentType contentType) { try { var result = _contentTypeRepository.UpdateContentType(contentType); //TODO: Update properties Add/Remove/Update if (result != null) { return(Ok(result)); } return(NotFound()); } catch (Exception ex) { _logger.LogError(string.Format("Error occured while updating content type"), ex); return(new StatusCodeResult(StatusCodes.Status500InternalServerError)); } }