Ejemplo n.º 1
0
        //create new Region

        public async Task CreateRegion(CreateRegionInput input)
        {
            var Region = input.MapTo <Region>();

            var RegionExist = _regionRepository.FirstOrDefault(p => p.Name == input.Name);

            if (RegionExist == null)
            {
                await _regionRepository.InsertAsync(Region);
            }
            else
            {
                throw new UserFriendlyException("There is already a Region with given name");
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Create(CreateRegionInput input)
        {
            // TODO: Add insert logic here

            if (ModelState.IsValid)
            {
                await _regionAppService.CreateRegion(input);

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(input));
            }
        }