コード例 #1
0
        public async Task AddDependentAsync(AddDependentModel newDependent)
        {
            var response = await _client.PostAsJsonAsync("api/EmployeeBenefits/AddDependet", newDependent);

            if (!response.IsSuccessStatusCode)
            {
                //todo: log errors
            }
        }
コード例 #2
0
        public IActionResult AddDependent(string name)
        {
            var employee = employeeService.Get(name);

            var model = new AddDependentModel
            {
                EmployeeName  = employee.Name,
                DependentName = string.Empty
            };

            return(View(model));
        }
コード例 #3
0
        public IActionResult AddDependent(AddDependentModel model)
        {
            var employee = employeeService.Get(model.EmployeeName);

            employee.Dependents.Add(new Person
            {
                Name = model.DependentName
            });

            employeeService.Save(employee);

            return(Redirect("/Employee/" + model.EmployeeName));
        }
コード例 #4
0
        public async Task <IActionResult> AddDependet(AddDependentModel dependet)
        {
            try
            {
                await new DependentOrchestration().AddDependetAsync(_dependentRepository, dependet).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.InnerException));
            }

            return(Ok());
        }
コード例 #5
0
        public async Task <IActionResult> AddDependet(AddDependentModel dependet)
        {
            try
            {
                await new DependentTransactions().AddDependentAsync(_addDependentCommand, dependet).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.InnerException));
            }

            return(Ok());
        }
コード例 #6
0
        public async Task AddDependentAsync(AddDependentModel newDependent)
        {
            try
            {
                var response = await _client.PostAsJsonAsync("api/Dependents/AddDependet", newDependent);

                if (response.IsSuccessStatusCode)
                {
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                // add log
                throw;
            }
        }
コード例 #7
0
 public async Task AddDependetAsync(IDependentRepository dependetRepository, AddDependentModel addDependentModel)
 {
     //todo: add logs and error checking
     await dependetRepository.AddDependentAsync(addDependentModel);
 }
コード例 #8
0
        public async Task AddDependentAsync(IAddCommandNoResult <Dependent> addEmployeeCommand, AddDependentModel dependentModel)
        {
            //  todo: apply error checking before executing command
            var now       = DateTime.Now;
            var dependent = new Dependent();

            dependent.Id         = Guid.NewGuid();
            dependent.EmployeeId = dependentModel.EmployeeId;
            dependent.FirstName  = dependentModel.FirstName;
            dependent.LastName   = dependentModel.LastName;
            dependent.Ssn        = dependentModel.Ssn;
            dependent.Dob        = dependentModel.Dob;
            dependent.CreatedOn  = now;
            dependent.CreatedBy  = string.Empty;
            dependent.UpdatedOn  = now;
            dependent.UpdatedBy  = string.Empty;
            await addEmployeeCommand.ExecuteAsync(dependent);
        }