示例#1
0
        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());
        }
示例#2
0
        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));
        }