예제 #1
0
        public void CreateZone(CreateZoneInput input)
        {
            var zone = new Zone {
                ZoneCode = input.ZoneCode, ZoneName = input.ZoneName, CreatorUserId = input.CreatorUserId
            };

            _zoneRepository.Insert(zone);
        }
예제 #2
0
        //create new zone

        public async Task CreateZone(CreateZoneInput input)
        {
            var zone = input.MapTo <Zone>();

            var ZoneExist = _zoneRepository.FirstOrDefault(p => p.Name == input.Name);

            if (ZoneExist == null)
            {
                await _zoneRepository.InsertAsync(zone);
            }
            else
            {
                throw new UserFriendlyException("There is already a Zone with given name");
            }
        }
예제 #3
0
        public async Task <ActionResult> Create(CreateZoneInput input)
        {
            // TODO: Add insert logic here

            if (ModelState.IsValid)
            {
                await _zoneAppService.CreateZone(input);

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