Example #1
0
        public IHttpActionResult GetDoctorsList(string authId, string name, string client, string email, string phoneNum, string jobLevel, string voiceGrade, int?page, int?count, string sortCol, string sortDir)
        {
            try
            {
                using (MaxMasterDbEntities db = new MaxMasterDbEntities())
                {
                    // stored procedure [dbo].[DoctorDetailsGet] to retreive list of doctors
                    int totalCount  = 0;
                    var DoctorsList = db.DoctorDetailsGet(authId, name, client, email, phoneNum, jobLevel, voiceGrade, page, count, sortCol, sortDir).ToList();

                    if (DoctorsList.Count > 0)
                    {
                        totalCount = (int)DoctorsList.FirstOrDefault().TotalCount;
                    }
                    return(Content(HttpStatusCode.OK, new { DoctorsList, 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"));
            }
        }