コード例 #1
0
        public ActionResult assignRepairman(int id, int rid)
        {
            Request r = _RequestService.GetById(id);

            r.RepairmanID = rid;
            r.Status      = "Active";
            _RequestService.Update(r);

            Repairman r1 = _RepairmanService.GetById(rid);

            r1.Status = "Active";
            _RepairmanService.Update(r1);


            return(RedirectToAction("viewpendingservice", new { id = r.RequestID }));
        }
コード例 #2
0
        public ActionResult editProfile(string name, string address, string phone)
        {
            if ((Session["userId"] == null) || (Convert.ToInt32(Session["type"]) != 2))
            {
                return(RedirectToAction("login", "Common"));
            }

            EditProfileViewModel EPVM = new EditProfileViewModel();

            EPVM.repairman = _RepairmanService.GetById(Convert.ToInt32(Session["userId"]));

            EPVM.repairman.Name        = name;
            EPVM.repairman.Address     = address;
            EPVM.repairman.PhoneNumber = phone;

            _RepairmanService.Update(EPVM.repairman);

            return(View(EPVM));
        }
コード例 #3
0
        public ActionResult changeRate(string star, string comment, int r, int c, string page)
        {
            IEnumerable <Review> reviews = _ReviewService.GetByBothId(r, c);

            if (Equals(star, ""))
            {
                star = "0";
            }
            if (reviews.Count() > 0)
            {
                foreach (var item in reviews)
                {
                    item.Rating  = Convert.ToDouble(star);
                    item.Comment = comment;
                    _ReviewService.Update(item);
                }
            }

            else
            {
                Review r1 = new Review();

                r1.CustomerID  = c;
                r1.RepairmanID = r;
                r1.Rating      = Convert.ToDouble(star);
                r1.Comment     = comment;
                _ReviewService.Insert(r1);
            }
            Repairman rr = _RepairmanService.GetById(r);

            IEnumerable <Review> reviews1 = _ReviewService.GetByRepairmanId(r);
            double rat;

            if (reviews1.Count() != 0)
            {
                rat       = (((reviews1.Count() - 1) * rr.Rating) + Convert.ToDouble(star)) / reviews1.Count();
                rr.Rating = rat;
            }
            _RepairmanService.Update(rr);

            if (Equals(page, "myServices"))
            {
                return(RedirectToAction(page, "Customer"));
            }

            else
            {
                return(RedirectToAction(page, "Customer", new { id = r }));
            }
        }