コード例 #1
0
        public System.Net.Http.HttpResponseMessage DocAppointmentDetails(int id = 0)
        {
            System.Net.Http.HttpResponseMessage retObject = null;

            if (id > 0)
            {
                UserAppointmentService _appservice          = new UserAppointmentService();
                IEnumerable <Entities.UserAppointments> app = _appservice.GetAppointmentsByDocID(id);

                if (app.Count() <= 0)
                {
                    var       message = string.Format("No appointment found for doctor [{0}]", id);
                    HttpError err     = new HttpError(message);
                    retObject = Request.CreateErrorResponse(System.Net.HttpStatusCode.NotFound, err);
                    retObject.ReasonPhrase = message;
                }
                else
                {
                    retObject = Request.CreateResponse(System.Net.HttpStatusCode.OK, app);
                }
            }
            else
            {
                var       message = string.Format("doc id can not be zero");
                HttpError err     = new HttpError(message);
                retObject = Request.CreateErrorResponse(System.Net.HttpStatusCode.NotFound, err);
                retObject.ReasonPhrase = message;
            }
            return(retObject);
        }
コード例 #2
0
        public System.Net.Http.HttpResponseMessage BookAppointment(string email, int rowid = 0)
        {
            System.Net.Http.HttpResponseMessage retObject = null;

            if (rowid > 0 && email != "")
            {
                UserAppointmentService _appservice = new UserAppointmentService();
                bool success = _appservice.BookAppointment(Appointments.Utility.Utilities.RemoveJunkChar(email), rowid);

                if (!success)
                {
                    var       message = string.Format("error occur for updating data", rowid);
                    HttpError err     = new HttpError(message);
                    retObject = Request.CreateErrorResponse(System.Net.HttpStatusCode.NotFound, err);
                    retObject.ReasonPhrase = message;
                }
                else
                {
                    retObject = Request.CreateResponse(System.Net.HttpStatusCode.OK, "SUCCESS");
                }
            }
            else
            {
                var       message = string.Format("doc id and emial can not be zero or blank");
                HttpError err     = new HttpError(message);
                retObject = Request.CreateErrorResponse(System.Net.HttpStatusCode.NotFound, err);
                retObject.ReasonPhrase = message;
            }
            return(retObject);
        }
コード例 #3
0
        public System.Net.Http.HttpResponseMessage UserAppointments(string email = null)
        {
            System.Net.Http.HttpResponseMessage retObject = null;

            if (!string.IsNullOrEmpty(email))
            {
                UserAppointmentService _appservice          = new UserAppointmentService();
                IEnumerable <Entities.UserAppointments> app = _appservice.GetAppointmentsByEmail(email);

                if (app.Count() <= 0)
                {
                    var       message = string.Format("No appointment found for the user [{0}]", email);
                    HttpError err     = new HttpError(message);
                    retObject = Request.CreateErrorResponse(System.Net.HttpStatusCode.NotFound, err);
                    retObject.ReasonPhrase = message;
                }
                else
                {
                    retObject = Request.CreateResponse(System.Net.HttpStatusCode.OK, app);
                }
            }
            else
            {
                var       message = string.Format("No email provided");
                HttpError err     = new HttpError(message);
                retObject = Request.CreateErrorResponse(System.Net.HttpStatusCode.NotFound, err);
                retObject.ReasonPhrase = message;
            }
            return(retObject);
        }