Exemple #1
0
 public IHttpActionResult GetAllEmployees(string empNum, string name, string email, string phoneNum, string department, string designation, string manager, int?orgId, int?page, int?count, string sortCol, string sorDir)
 {
     try
     {
         using (MaxMasterDbEntities db = new MaxMasterDbEntities())
         {
             var totalCount = 0;
             var employees  = db.GetEmployees(empNum, name, email, phoneNum, department, designation, manager, orgId, page, count, sortCol, sorDir).ToList();
             if (employees.Count > 0)
             {
                 totalCount = (int)employees.FirstOrDefault().TotalCount;
             }
             return(Content(HttpStatusCode.OK, new { employees, totalCount }));
         }
     }
     catch (Exception ex)
     {
         new Error().logAPIError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString(), ex.StackTrace);
         return(Content(HttpStatusCode.InternalServerError, "An error ocuured, Please try again later!"));
     }
 }