public ActionResult AddPetLostInfo(LostFound petLost)
        {
            ViewBag.citylist = getCities();
            var cityId = Request.Form["citylist"];

            var cUser = (Customer)Session["currentUser"];
            petLost.CustomerId = cUser.CustomerId;
            petLost.City = Convert.ToInt16(cityId);

            if (petLost.Description == null)
            {
                petLost.Description = "";
            }

            db.LostFounds.Add(petLost);
            db.SaveChanges();
            ViewBag.Message = "Your lost pet information has been posted. Your lost report ID is " + petLost.LostFoundId + ".";
            ViewBag.Message2 = "Please do not lose your report ID. You need it to keep track your lost report.";
            ViewBag.Message3 = "Thank you for using our service.";
            return View();
        }
        public ActionResult TrackReportResult(LostFound petLost)
        {
            LostFound thePetLost = db.LostFounds.Find(petLost.LostFoundId);
            var cUser = (Customer)Session["currentUser"];

            // Check whether the user is a valid and authorized user
            if (thePetLost != null && (Session["currentUser"] != null))
            {
                if (thePetLost.CustomerId == cUser.CustomerId)
                {
                    ViewBag.ReportId = thePetLost.LostFoundId;
                    ViewBag.PetCategory = thePetLost.PetCategory;
                    ViewBag.Description = thePetLost.Description;
                    var comment = (from theComment in db.LF_Comment
                                   join theOwner in db.Customers on theComment.CommenterId equals theOwner.CustomerId
                                   where theComment.InfoId.Equals(petLost.LostFoundId)
                                   select new SearchLostPetResult
                                   {
                                       lostInfoId = theComment.InfoId,
                                       pet_owner_name = theOwner.FirstName + " " + theOwner.LastName,
                                       pet_category = "",
                                       city = "",
                                       pet_desc = theComment.Comment
                                   }).Distinct();

                    return View(comment.AsEnumerable());
                }
                else
                {
                    ViewBag.error = "You are not authorized to view this Report";
                }
            }
            else
            {
                ViewBag.error = "No such report exists.";
            }
            return View();
        }
        public ActionResult PetLostHelpInfoResult(LostFound petLost)
        {
            ViewBag.citylist = getCities();
            var cityId = Convert.ToInt32(Request.Form["citylist"]);

            var petLostQuery = (from theOwner in db.Customers
                                join theLostInfo in db.LostFounds on theOwner.CustomerId equals theLostInfo.CustomerId
                                join theCity in db.Cities on theLostInfo.City equals theCity.CityId
                                where theLostInfo.PetCategory.Equals(petLost.PetCategory)
                                where theLostInfo.City.Equals(cityId)
                                select new SearchLostPetResult
                                {
                                    lostInfoId = theLostInfo.LostFoundId,
                                    pet_owner_name = theOwner.FirstName + " " + theOwner.LastName,
                                    pet_category = theLostInfo.PetCategory,
                                    city = theCity.Name,
                                    pet_desc = theLostInfo.Description
                                }).Distinct();

            //int abc = petLostQuery.Count();
            return View(petLostQuery.AsEnumerable());
        }