public async Task <IActionResult> PutBlog([FromRoute] int id, [FromBody] Blogs blog, [FromHeader] string UserName) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != blog.BlogId) { return(BadRequest()); } //Models.Users user = _bUsersRepository.GetAll().Where(P => P.UserName == UserName).FirstOrDefault(); //if (blog.UserId != user.UserId) // return BadRequest(); try { await _blogsRepository.Update(blog); return(Ok(blog)); } catch (DbUpdateConcurrencyException) { if (!await BlogExists(id)) { return(NotFound()); } else { throw; } } }
public GeneralResponse Update(Blog item) { _repository.Update(item); return(new GeneralResponse()); }