public DataContract.EmployeeResponse Create(DataContract.Employee employee) { EmployeeResponse response = new EmployeeResponse(); try { employee.JoiningDate = DateTime.UtcNow; var result = _manager.Create(employee.ToDomainModel()); if (result == null) { response.Status.StatusCode = "500"; response.Status.Message = "Error in creating employee"; return response; } response.Employee = result.ToDataContract(); return response; } catch (Exception ex) { ExceptionPolicy.HandleException("service.policy", ex); response.Status.StatusCode = "500"; response.Status.Message = "Error in creating Employee"; return response; } }
public DataContract.RemarkResponse AddRemark(string employeeId, DataContract.Remark remark) { RemarkResponse response = new RemarkResponse(); try { var result = _manager.AddRemark(employeeId, remark.ToDomainModel()); if (result == null) { response.Status.StatusCode = "500"; response.Status.Message = "Error in creating employee"; return response; } response.Remark = result.ToDataContract(); return response; } catch (Exception ex) { ExceptionPolicy.HandleException("service.policy", ex); response.Status.StatusCode = "500"; response.Status.Message = "Error in creating Employee"; return response; } }
public DataContract.Employee Create(DataContract.Employee employee) { try { var result = _manager.Create(employee.ToDomainModel()); if (result == null) return null; return result.ToDataContract(); } catch (Exception ex) { Exception newEx; var rethrow = ExceptionPolicy.HandleException("service.policy", ex, out newEx); throw newEx; } }
public DataContract.Remark AddRemark(string employeeId, DataContract.Remark remark) { try { var result = _manager.AddRemark(employeeId, remark.ToDomainModel()); if (result == null) return null; return result.ToDataContract(); } catch (Exception ex) { Exception newEx; var rethrow = ExceptionPolicy.HandleException("service.policy", ex, out newEx); throw newEx; } }
public DataContract.Employee Authenticate(DataContract.Credential credential) { try { var result = _manager.Authenticate(credential.ToDomainModel()); if (result == null) return null; return result.ToDataContract(); } catch (Exception ex) { var rethrow = ExceptionPolicy.HandleException("service.policy", ex); if (rethrow) throw; return null; } }