public async Task AddDependentAsync(AddDependentModel newDependent)
        {
            var response = await _client.PostAsJsonAsync("api/EmployeeBenefits/AddDependet", newDependent);

            if (!response.IsSuccessStatusCode)
            {
                //todo: log errors
            }
        }
        public IActionResult AddDependent(string name)
        {
            var employee = employeeService.Get(name);

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

            return(View(model));
        }
        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));
        }
Example #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());
        }
        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());
        }
Example #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;
            }
        }
 public async Task AddDependetAsync(IDependentRepository dependetRepository, AddDependentModel addDependentModel)
 {
     //todo: add logs and error checking
     await dependetRepository.AddDependentAsync(addDependentModel);
 }
Example #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);
        }