public IActionResult Put(int id, [FromBody] BlogArticle blogarticle) { try { if (blogarticle == null || !ModelState.IsValid) { return(BadRequest(ErrorCode.TitleAndContentRequired.ToString())); } var existingBlogArticle = _repository.GetById(id); if (existingBlogArticle == null) { return(NotFound(ErrorCode.RecordNotFound.ToString())); } _repository.UpdateAsync(blogarticle); } catch (Exception e) { return(BadRequest(ErrorCode.CouldNotUpdateItem.ToString())); } return(NoContent()); }