Пример #1
0
        public async Task <ActionResult> ModifierBox([FromBody] BoxDTO boxDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            int id  = Decimal.ToInt32(boxDTO.Id);
            Box box = await boxDAO.GetBoxById(id);

            if (box == null)
            {
                return(NotFound());
            }

            if (!User.IsInRole(Constants.Roles.Admin))
            {
                return(Forbid());
            }

            await boxDAO.ModifierBox(box, boxDTO);

            return(Ok(boxDTO));
        }