Esempio n. 1
0
        public async Task <IActionResult> Post([FromBody] ModelImg model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _unitOfWork.ModelImgs.AddAsync(model);

            int i = await _unitOfWork.Complete();

            return(Ok(i));
        }
Esempio n. 2
0
        public async Task <IActionResult> Put([FromRoute] int id, [FromBody] ModelImg model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != model.Id)
            {
                return(BadRequest());
            }

            _unitOfWork.ModelImgs.Update(model);

            await _unitOfWork.Complete();

            return(NoContent());
        }