コード例 #1
0
        public async Task <IActionResult> RemoveAward([FromBody] MovieAwardViewModel award)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var newAward = Mapper.Map <MovieAward>(award);

            _repository.RemoveAward(newAward);
            if (await _repository.SaveChangesAsync())
            {
                return(Ok("Award has been removed"));
            }

            return(BadRequest("Failed to save changes to the database"));
        }