Пример #1
0
        public async Task <IActionResult> Deactivate([FromRoute] int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            try
            {
                await _laboratoryService.DeactivateLab(id);
            }
            catch (NullReferenceException)
            {
                if (!(await _laboratoryService.LabExists(id)))
                {
                    return(NotFound());
                }
            }
            catch (DbUpdateException)
            {
                return(BadRequest());
            }

            return(Ok());
        }