예제 #1
0
        public ActionResult Create(Organisation organisation)
        {
            if (ModelState.IsValid)
            {
                _organisationService.Add(organisation);
                return(RedirectToAction("Index"));
            }

            return(View(organisation));
        }
        public async Task <IActionResult> Add(OrganisationAddDto newOrg)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var org       = _mapper.Map <Organisation>(newOrg);
            var orgResult = await _orgServices.Add(org);

            if (orgResult == null)
            {
                return(BadRequest());
            }

            return(Ok(_mapper.Map <OrganisationResultDto>(orgResult)));
        }
예제 #3
0
        public async Task <IActionResult> Add([FromBody] OrganisationViewModel viewModel)
        {
            var id = await _service.Add(viewModel);

            return(Ok(id));
        }