public ActionResult SendIssue(string Message) { Report reportIssue = new Report() { ReceptionistId = Convert.ToInt32(Session["Id"]), ReceptionistName = Session["Name"].ToString(), ReceptionistSurname = Session["Surname"].ToString(), Issue = Message }; db.Reports.Add(reportIssue); db.SaveChanges(); return(RedirectToAction("Homepage", "Account")); }
public ActionResult ReserveForScreen32(ReservedSeat obj, Screen32 scr) { if (ModelState.IsValid) { /*obj.Name = data["customerName"].ToString(); * obj.Surname = data["customerSurname"].ToString(); * obj.Time = data["movieTime"].ToString(); */ string numOfSeat = obj.ReservedSeats; string[] arraySeat = numOfSeat.Split(','); for (int i = 0; i < arraySeat.Length; i++) { string sn = arraySeat[i]; db.Screen32.Where( a => a.SeatNumber == sn ).Single().isReserved = true; } db.ReservedSeats.Add(obj); db.SaveChanges(); return(RedirectToAction("Reservation")); } else { ModelState.Clear(); ViewBag.Error = "Something went wrong. Try again or contact with Administrator."; return(RedirectToAction("Reservation", obj)); } }
public ActionResult ClearSeatScreen3() { if (Session["Role"] == null) { return(RedirectToAction("Login")); } if (!Session["Role"].Equals(250)) { return(RedirectToAction("Login")); } var arraySeat = new string[] { "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8", "G9" }; using (AlicanContext db = new AlicanContext()) { var clear = db.Screen3.Where(c => arraySeat.Contains(c.SeatNumber)).ToList(); clear.ForEach(a => a.isReserved = false); var clear2 = db.Screen32.Where(c => arraySeat.Contains(c.SeatNumber)).ToList(); clear2.ForEach(a => a.isReserved = false); var clear3 = db.Screen33.Where(c => arraySeat.Contains(c.SeatNumber)).ToList(); clear3.ForEach(a => a.isReserved = false); db.SaveChanges(); } return(RedirectToAction("AdminPanel")); }
public ActionResult Register(UserAccount useraccount) { if (Session["Role"] == null) { return(RedirectToAction("Login")); } if (!Request.IsAuthenticated && !Session["Role"].Equals(250)) { return(RedirectToAction("Login")); } if (ModelState.IsValid) { using (AlicanContext db = new AlicanContext()) { useraccount.Active = true; useraccount.Role = 255; db.UserAccounts.Add(useraccount); db.SaveChanges(); } ModelState.Clear(); ViewBag.Message = useraccount.Name + " " + useraccount.Surname + " registered."; } return(RedirectToAction("ListReceptionists")); }
public ActionResult DeleteMovie(int?MovieId) { if (Session["Role"] == null) { return(RedirectToAction("Login")); } if (!Session["Role"].Equals(250)) { return(RedirectToAction("Login")); } Movie mv = db.Movies.Find(MovieId); db.Movies.Remove(mv); db.SaveChanges(); return(RedirectToAction("ListMovies")); }
public ActionResult AddMovie(Movie addMovie, HttpPostedFileBase image) { List <Category> categories = db.Categories.ToList(); ViewData["cats"] = categories; if (ModelState.IsValid) { byte[] imagee = null; if (Request.Files.Count > 0) { image = Request.Files[0]; using (BinaryReader br = new BinaryReader(image.InputStream)) { imagee = br.ReadBytes(image.ContentLength); } } //if (picture != null && picture.ContentLength > 0) // { // var path = Server.MapPath("~/Images/" + picture.FileName); // picture.SaveAs(path); // ViewBag.Path = "Picture has been saved in " + path + "\nNamed: " + addMovie.Name; // } using (AlicanContext db = new AlicanContext()) { // addMovie.PicturePath = picture.FileName; addMovie.Image = imagee; db.Movies.Add(addMovie); db.SaveChanges(); } ModelState.Clear(); ViewBag.Message = addMovie.Name + " registered."; ViewBag.GoBack = "@Html.ActionLink('Go Back', 'AdminPanel')"; } return(RedirectToAction("ListMovies")); }