示例#1
0
        public IHttpActionResult GetDefaultAllocation(int?ClientId, int?DoctorId, int?EmployeeId, string JobLevel, int page, int count, string SortCol, string SortDir)
        {
            try
            {
                using (MaxMasterDbEntities db = new MaxMasterDbEntities())
                {
                    var defaultAllocations = db.GetDefaultAllocations(ClientId, DoctorId, EmployeeId, JobLevel, page, count, SortCol, SortDir).ToList();

                    int totalCount = 0;

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