Exemplo n.º 1
0
        public ActionResult ServiceDetail(String title)
        {
            Service service = ServicePersistence.GetService(title);

            service.Comments = CommentPersistence.getCommentsForaService(service);
            Comment comment = new Comment();

            comment.Service = service;

            return(View(Tuple.Create(service, comment)));
        }
Exemplo n.º 2
0
        public ActionResult AddService(Service service)
        {
            if (Session["userId"] == null || Session["IsProvider"].Equals(false))
            {
                TempData["serviceAdded"] = "Please Log in.";
                return(View(service));
            }
            service.Owner    = UserPersistence.GetUser(Session["userId"].ToString());
            service.Comments = CommentPersistence.getCommentsForaService(service);
            service.date     = DateTime.Now;

            string t  = service.Description.Replace("<", "&lt");
            string t1 = t.Replace(">", "&gt");
            string t2 = t1.Replace("(", "&#40");
            string t3 = t2.Replace(")", "&#41");
            string t4 = t3.Replace("&", "&#38");

            t4 = t4.Replace("'", "");
            string tfinal = t4.Replace("|", "&#124");

            service.Description = tfinal;

            bool?acceptible = false;

            acceptible = ServiceManager.AddNewService(service);
            if ((acceptible != null))
            {
                if (acceptible == true)
                {
                    TempData["serviceAdded"] = "Service is added successfully.";
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    TempData["serviceAdded"] = "Service could not be added.";
                    return(View(service));
                }
            }
            else
            {
                TempData["serviceAdded"] = "Service could not be added.";
                return(View(service));
            }
        }