public HttpResponseMessage AddUpdateEmployeeDailyReportByTeamLeader(EmployeeDailyReportDomainModel model) { HttpResponseMessage httpResponse = new HttpResponseMessage(); ResponseDomainModel response = new ResponseDomainModel(); try { response = employeeDailyStatusReportRepository.AddDailyStatusReportByTeamLeader(model); if (response == null) { response.isSuccess = false; httpResponse = Request.CreateResponse(HttpStatusCode.InternalServerError, "Error Occurred"); } else if (response.isSuccess == true) { httpResponse = Request.CreateResponse(HttpStatusCode.OK, response); } else { response.isSuccess = false; httpResponse = Request.CreateResponse(HttpStatusCode.NotImplemented, response); } return(httpResponse); } catch (Exception ex) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent("An error occurred, please try again or contact the administrator."), ReasonPhrase = "An error occurred, please try again or contact the administrator.", StatusCode = HttpStatusCode.InternalServerError }); } }
public ResponseDomainModel AddDailyStatusReportByTeamLeader(EmployeeDailyReportDomainModel model) { ResponseDomainModel objRes = new ResponseDomainModel(); try { if (model != null) { var add = objHelper.Query <string>("AddUpdateEmployeeDailyReport", new { DailyReportId = model.DailyReportId, EmployeeId = model.EmployeeId, ReportDate = DateTime.Now, ProjectId = model.ProjectId, ReportCategoryId = model.ReportCategoryId, Description = model.Description, WorkingHours = model.WorkingHours, Filename = model.Filename, IsActive = true, CreatedDate = model.CreatedDate, CreatedBy = model.CreatedBy, IsByTeamLeader = true }).FirstOrDefault(); if (add == "Insert") { objRes.isSuccess = true; objRes.response = "Status Report Saved Successfully."; } else if (add == "Update") { objRes.isSuccess = true; objRes.response = "Status Report Updated Successfully."; } else { objRes.isSuccess = false; objRes.response = "Status Report not saved."; } } return(objRes); } catch (Exception ex) { ErrorLog.LogError(ex); return(null); } }