예제 #1
0
        public IHttpActionResult GetClientEmployees(int?clientId, string firstName, string lastName, string email, string primaryPhone, string department, int?orgId, int?page, int?count)
        {
            try
            {
                using (MaxMasterDbEntities db = new MaxMasterDbEntities())
                {
                    var totalCount = 0;
                    // Get the list of client employees through  db.GetClientEmployees stored procedure
                    var clientEmployees = db.GetClientEmployees(clientId, firstName, lastName, email, primaryPhone, department, orgId, page, count).ToList();

                    if (clientEmployees.Count > 0)
                    {
                        totalCount = (int)clientEmployees.FirstOrDefault().TotalCount;
                    }
                    return(Content(HttpStatusCode.OK, new { clientEmployees, totalCount }));
                }
            }
            catch (Exception ex)
            {
                new Error().logAPIError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString(), ex.StackTrace);
                return(Content(HttpStatusCode.InternalServerError, "An error occoured, please try again!"));
            }
        }