コード例 #1
0
        public async Task <IActionResult> AddFireFighter(FireFighterCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Model not valid"));
            }
            await fireFighterViewModelService.AddFireFighter(model);

            return(Ok(model));
        }
コード例 #2
0
        public async Task AddFireFighter(FireFighterCreateViewModel model)
        {
            logger.LogInformation("AddFireFighter called");

            if (model.PhoneNumber == null)
            {
                model.PhoneNumber = "none";
            }

            var fireFighter = new FireFighter();

            fireFighter.Update(model.FirstName, model.LastName, model.Email, new Phone(model.PhoneNumber), model.FireDepartmentId);
            await fireFighterRepository.AddAsync(fireFighter);
        }