public Task <EmpEmployeeModel> GetAsync(int id) { var dal = _empEmployeeRepository.Get(id); if (dal == null) { return(Task.FromResult <EmpEmployeeModel>(null)); } else { EmpEmployeeModel model = AutoMapperGenericHelper <EmpEmployee, EmpEmployeeModel> .Convert(dal); return(Task.FromResult(model)); } }
public IHttpActionResult Put(EmpEmployeeModel model) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _empEmployeeService.UpdateAsync(model); return(Ok()); } catch (Exception ex) { return(InternalServerError(ex)); } }
public Task UpdateAsync(EmpEmployeeModel model) { if (model == null) { throw new ArgumentNullException("EmpEmployeeModel ArgumentNullException Insert Async"); } EmpEmployee dto = AutoMapperGenericHelper <EmpEmployeeModel, EmpEmployee> .Convert(model); EmpEmployeePk pk1 = _empEmployeePkRepository.Get((int)model.EmployeePkId); dto.EmpEmployeePk = pk1; if (pk1 == null) { throw new ArgumentNullException("EmployeePkId ArgumentNullException Insert Async"); } _empEmployeeRepository.Update(dto); return(Task.FromResult <object>(null)); }