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.EmployeeResponse Authenticate(DataContract.Credentials credentials) { EmployeeResponse response = new EmployeeResponse(); var result = _manager.Authenticate(credentials.EmailId, credentials.Password); if (result == null) { response.Status.StatusCode = "500"; response.Status.Message = "Error in creating employee"; return response; } response.Employee = result.ToDataContract(); return response; }