public OutputBase CreateOrEditDependant(DependantDto dependant) { _dependantRepository.InsertOrUpdate(Mapper.Map <Dependant>(dependant)); return(new OutputBase { Message = "Dependant added", Success = true }); }
public async Task <PartialViewResult> CreateOrEditDependantModal(int?id, int employeeId) { var output = new DependantDto { DateOfBirth = Clock.Now }; if (id != null) { output = _employeeService.GetDependant(new GetDependantInput { DependantId = id.Value }); } var viewModel = new CreateOrEditDependantModel(output, id == null || id == 0); ViewBag.EmployeeId = employeeId; return(PartialView("EmployeeDetail/Dependants/_CreateOrEditDependantModal", viewModel)); }
public CreateOrEditDependantModel(DependantDto input, bool isNew) { IsEditMode = !isNew; Dependant = input; }