public ActionResult AddComment(string text) { CommentConnect cc = new CommentConnect(); cc.AddComment(text, Globals.PRESENT_LOC.Id, Globals.PRESENT_LOC.Id); ViewBag.searchLocationResult = Globals.PRESENT_LOC; return(View("ShowLocation")); }
public ActionResult ShowLocation(string id) { LocationConnect lc = new LocationConnect(); Message response = lc.SearchLocation(id, Globals.LOCATION_SEARCHABLE_ATTRIBUTES.ID); if (!response.GetResult()) { ViewBag.ErrorMessage = "Unable to find the given location."; return(View("Error")); } else { List <Location> locList = (List <Location>)response.GetPayload(); if (locList.Count > 1) //This should realisiticly never happen { ViewBag.ErrorMessage = "Something has gone worng in the location database"; Utilities.EventLogger("Found more than one location with the same id trying to show a location.", Globals.LOG_LEVELS.Critical); return(View("Error")); } ViewBag.searchLocationResult = locList.ElementAt(0); Globals.PRESENT_LOC = locList.ElementAt(0); CommentConnect cc = new CommentConnect(); Message commentResponse = cc.GetLocationComments(id); if (commentResponse.GetResult()) { List <Comment> commList = (List <Comment>)commentResponse.GetPayload(); ViewBag.locationCommentResult = commList; } else { ViewBag.locationCommentError = commentResponse.GetText(); } } return(View()); }