Пример #1
0
        public async Task <ActionResult> DeleteConfirmed(int Id)
        {
            var typeDTO = await _typeService.GetTypeWithSubtypesAsync(Id);

            if (typeDTO.Subtypes.Count > 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Нельзя удалить тип у которого не 0 подтипов"));
            }

            if (await _typeService.DeleteAsync(Id) == false)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Edit error"));
            }

            return(RedirectToAction("Index"));
        }