Exemplo n.º 1
0
        [Route("api/v1/leavehistory/id/{employee_id?}")] // display Leavehistory in leavepage by employee id
        public HttpResponseMessage GetLeaveHistoryById(int employee_id)
        {
            HttpResponseMessage response = null;

            try
            {
                List <LeavehistoryModel> leave_history_model = LeaveRepo.GetLeaveHistoryById(employee_id);
                //foreach (LeavehistoryModel leave in leave_history_model)
                //{
                //    if (leave.leave_status == "Pending" || (leave.leave_status == "Approved" && leave.from_date > DateTime.Now))
                //    {
                //        leave.cancel_flag = 1;
                //    }
                //}
                response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_513", "approved", leave_history_model));
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                Debug.WriteLine(exception.GetBaseException());
                response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message));
            }
            return(response);
        }