예제 #1
0
        public IActionResult DeleteCompany([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var removed = _companyRepo.DeleteCompany(id);

            return((removed == null) ? (IActionResult)NotFound() : Ok(removed));
        }
예제 #2
0
        public ActionResult DeleteCompany(Guid id)
        {
            var companyModelFromRepo = _repository.GetCompanyById(id);

            if (companyModelFromRepo != null)
            {
                _repository.DeleteCompany(companyModelFromRepo);
                _repository.SaveChanges();

                return(NoContent());
            }
            return(NotFound());
        }