コード例 #1
0
        public IActionResult Add(Agency agency)
        {
            var result = _agencyRepository.Insert(agency);

            if (result.Success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                throw new Exception(result.Messages[0]);
            }
        }
コード例 #2
0
        public IActionResult Add(Agency agency)
        {
            var response = agencyRepo.Insert(agency);

            if (response.Success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(BadRequest(response.Message));
            }
        }