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

            await _unitOfWork.AdvertModelImgs.AddAsync(model);

            int i = await _unitOfWork.Complete();

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

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

            _unitOfWork.AdvertModelImgs.Update(model);

            await _unitOfWork.Complete();

            return(NoContent());
        }