public async Task <IActionResult> PutPosts(int id, DataModels.Posts Posts) { if (id != Posts.Id) { return(BadRequest()); } try { var mappaux = _mapper.Map <DataModels.Posts, data.Post>(Posts); new BS.Post(_context).Update(mappaux); } catch (DbUpdateConcurrencyException) { if (!PostsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <data.Post> > PostPosts(DataModels.Posts Posts) { var mappaux = _mapper.Map <DataModels.Posts, data.Post>(Posts); new BS.Post(_context).Insert(mappaux); return(CreatedAtAction("GetPosts", new { id = Posts.Id }, Posts)); }