Ejemplo n.º 1
0
        public ActionResult ReserveAction(DateTime Date, string Reason, string User, string Phone, int LocationReserved)
        {
            var             check           = db.ReservationsModels.Where(s => s.Date == Date).Take(1).SingleOrDefault();
            LocationsModels locationsModels = db.LocationsModels.Find(LocationReserved);

            if (check != null)
            {
                ViewBag.Message = "This Date is already booked";
                return(View());
            }
            else
            {
                if ((LocationReserved != null) && (User.Length > 3) && (Phone.Length > 9) && (Date != null))
                {
                    var Reservation = new ReservationsModels();

                    Reservation.Date             = Date;
                    Reservation.Reason           = Reason;
                    Reservation.LocationReserved = LocationReserved;
                    Reservation.User             = User;
                    Reservation.Phone            = Phone;

                    db.ReservationsModels.Add(Reservation);
                    db.SaveChanges();

                    string redirectUrl = "/Home/Index/";
                    return(Redirect(redirectUrl));
                }

                ViewBag.Name    = locationsModels.Name;
                ViewBag.Message = "Invalid Form";
                return(View());
            }
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            LocationsModels locationsModels = db.LocationsModels.Find(id);

            db.LocationsModels.Remove(locationsModels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,Name,City,State,Street,Number,AddressDetails,Description,Capacity")] LocationsModels locationsModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(locationsModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(locationsModels));
 }
Ejemplo n.º 4
0
        public ActionResult Reserve(int id = 0)
        {
            LocationsModels locationsModels = db.LocationsModels.Find(id);

            if (locationsModels == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Name = locationsModels.Name;
            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "Id,Name,City,State,Street,Number,AddressDetails,Description,Capacity")] LocationsModels locationsModels)
        {
            if (ModelState.IsValid)
            {
                db.LocationsModels.Add(locationsModels);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(locationsModels));
        }
Ejemplo n.º 6
0
        // GET: Locations/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LocationsModels locationsModels = db.LocationsModels.Find(id);

            if (locationsModels == null)
            {
                return(HttpNotFound());
            }
            return(View(locationsModels));
        }
Ejemplo n.º 7
0
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LocationsModels locationsModels = db.LocationsModels.Find(id);

            if (locationsModels == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Name = locationsModels.Name;

            return(View());
        }
Ejemplo n.º 8
0
        public ActionResult Details(int id, string month)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LocationsModels locationsModels = db.LocationsModels.Find(id);

            if (locationsModels == null)
            {
                return(HttpNotFound());
            }

            string fullScriptPath = Server.MapPath("~/CalendarRenderingScrips/") + "\\UsersCalendar.py";

            var textResult = run_cmd(fullScriptPath, id, month);

            ViewBag.Table = textResult;
            ViewBag.Name  = locationsModels.Name;
            ViewBag.Month = month;

            return(View());
        }