public bool SaveEmployee(Api.Models.Employee employee) { var result = new Data.Models.Employee(); result.EmployeeName = employee.Name; result.EmployeeAge = employee.Age; return(_repository.SaveEmployee(result)); }
public HttpResponseMessage GetSaveEmployee() { ApiModels.Employee employee = new ApiModels.Employee(); employee.Name = "XYZ"; employee.Age = 25; HttpResponseMessage httpResponseMessage = null; try { var result = _mapper.SaveEmployee(employee); httpResponseMessage = Request.CreateResponse(HttpStatusCode.OK, employee); } catch (Exception ex) { httpResponseMessage = Request.CreateResponse(HttpStatusCode.InternalServerError, new ApiModels.ErrorInfo() { ErrorMessage = ex.Message, ErrorStackTrace = ex.ToString() }); } return(httpResponseMessage); }