Example #1
0
        public ActionResult Dashboard(string phone, string pwd)
        {
            try
            {
                if (string.IsNullOrEmpty(phone) || string.IsNullOrEmpty(pwd))
                    return Json(new { Error = "Invalid input", status = 405 }, JsonRequestBehavior.AllowGet);

                IHomeFoodRepository repo = new HomeFoodRepository();
                var userDetail = repo.GetUser(phone, pwd);

                if (userDetail == null)
                    return Json(new { Message = "Invalid password or phone number", status = 405 }, JsonRequestBehavior.AllowGet);
                else
                {
                    Session["user"] = userDetail;
                    return View("Dashboard", userDetail);
                }

            }

            catch (Exception ex)
            {
                return Json(new { Error = ex.Message, status = 400 }, JsonRequestBehavior.AllowGet);
            }
        }
Example #2
0
        public JsonResult GetHotelDetails(string providerPhone)
        {
            try
            {
                IHomeFoodRepository repo = new HomeFoodRepository();
                var userDetail = repo.GetUser(providerPhone);
                var hotelDetails = repo.GetVirtualHotelDetail(providerPhone);

                var result = new
                {
                    FoodProvider = userDetail,
                    HotelDetails = hotelDetails
                };

                return Json(new { Data = result, status = 200 }, JsonRequestBehavior.AllowGet);

            }

            catch (Exception ex)
            {
                return Json(new { Error = ex.Message, status = 400 }, JsonRequestBehavior.AllowGet);
            }
        }