public void CreateZone(CreateZoneInput input) { var zone = new Zone { ZoneCode = input.ZoneCode, ZoneName = input.ZoneName, CreatorUserId = input.CreatorUserId }; _zoneRepository.Insert(zone); }
//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"); } }
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)); } }