Exemplo n.º 1
0
        public ActionResult SetCannedResponses(Guid id, [FromBody] IEnumerable <Guid> selectedCannedResponseIds)
        {
            var inspectionItemInDb = _context.InspectionItems
                                     .Include(ii => ii.InspectionItemCannedResponses)
                                     .ThenInclude(iicr => iicr.CannedResponse)
                                     .SingleOrDefault(item => item.Id == id);

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

            return(InspectionService.UpdateInspectionItemCannedResponses(_context, inspectionItemInDb, selectedCannedResponseIds.ToList()) ?
                   NoContent() :
                   StatusCode(500));
        }