Example #1
0
        public ActionResult Edit(AdminDocorReviewModel model)
        {
            var doctorReview = _doctorService.GetDoctorReviewById(model.Id);

            if (doctorReview == null)
            {
                //No product review found with the specified id
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                doctorReview.Title      = model.Title;
                doctorReview.ReviewText = model.ReviewText;
                doctorReview.IsApproved = model.IsApproved;
                doctorReview.ReplyText  = model.ReplyText;
                _doctorService.UpdateDoctorReview(doctorReview);

                //update product totals
                _doctorService.UpdateDoctorReviewTotals(doctorReview.Doctor);

                SuccessNotification("Review updated Successfully.");

                return(RedirectToAction("List"));
            }


            //If we got this far, something failed, redisplay form
            PrepareDoctorReviewModel(model, doctorReview, true, false);
            return(View(model));
        }
Example #2
0
        protected virtual void PrepareDoctorReviewModel(AdminDocorReviewModel model,
                                                        DoctorReview doctorReview, bool excludeProperties, bool formatReviewText)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (doctorReview == null)
            {
                throw new ArgumentNullException("doctorReview");
            }

            model.Id         = doctorReview.Id;
            model.DoctorId   = doctorReview.DoctorId;
            model.DoctorName = "Dr." + doctorReview.Doctor.AspNetUser.FirstName + " " + doctorReview.Doctor.AspNetUser.LastName;
            model.PatientId  = doctorReview.PatientId;
            var patient = doctorReview.Patient;

            model.PatientInfo = (patient != null) ? patient.FirstName + " " + patient.LastName : "None";
            // model.PatientInfo = patient.IsRegistered() ? patient.Email : _localizationService.GetResource("Admin.Customers.Guest");
            model.Rating    = doctorReview.Rating;
            model.ReplyText = doctorReview.ReplyText;
            model.CreatedOn = ConvertToUserTime(doctorReview.CreatedOnUtc, DateTimeKind.Utc);
            if (!excludeProperties)
            {
                model.Title      = doctorReview.Title;
                model.ReviewText = doctorReview.ReviewText;
                model.IsApproved = doctorReview.IsApproved;
            }
        }
Example #3
0
        public ActionResult Edit(int id)
        {
            var doctorReview = _doctorService.GetDoctorReviewById(id);

            if (doctorReview == null)
            {
                return(RedirectToAction("List"));
            }

            var model = new AdminDocorReviewModel();

            PrepareDoctorReviewModel(model, doctorReview, false, false);
            return(View(model));
        }
Example #4
0
        public ActionResult List(DataSourceRequest command)
        {
            var productReviews = _doctorService.GetAlldoctorReviews(null, null);
            var gridModel      = new DataSourceResult
            {
                Data = productReviews.Select(x =>
                {
                    var m = new AdminDocorReviewModel();
                    PrepareDoctorReviewModel(m, x, false, true);
                    return(m);
                }),
                Total = productReviews.TotalCount
            };

            return(Json(gridModel));
        }