public ActionResult ClearSeatScreen2() { 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.Screen2.Where(c => arraySeat.Contains(c.SeatNumber)).ToList(); clear.ForEach(a => a.isReserved = false); var clear2 = db.Screen22.Where(c => arraySeat.Contains(c.SeatNumber)).ToList(); clear2.ForEach(a => a.isReserved = false); var clear3 = db.Screen23.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 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")); }