Beispiel #1
0
        public IActionResult Create(CreateSpecialtyDTO createSpecialtyDTO)
        {
            if (ModelState.IsValid == false)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                CreateSpecialtyDTO result = _specialtyAppService.Insert(createSpecialtyDTO);
                _generalAppService.CommitTransaction();
                return(Created("Specialty created", result));
            }
            catch (Exception ex)
            {
                _generalAppService.RollbackTransaction();

                return(BadRequest(ex.Message));
            }
        }