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