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))); }
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("<", "<"); string t1 = t.Replace(">", ">"); string t2 = t1.Replace("(", "("); string t3 = t2.Replace(")", ")"); string t4 = t3.Replace("&", "&"); t4 = t4.Replace("'", ""); string tfinal = t4.Replace("|", "|"); 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)); } }