public ActionResult PositionList() { using (HotelAtrEntity db = new HotelAtrEntity()) { return(View(db.Positions.ToList())); } }
public ActionResult EditRoom(int id) { using (HotelAtrEntity db = new HotelAtrEntity()) { return(View(db.Rooms.Find(id))); } }
public ActionResult StaffList() { using (HotelAtrEntity db = new HotelAtrEntity()) { return(View(db.Staffs.ToList())); } }
public ActionResult DetailsStaff(int id) { using (HotelAtrEntity db = new HotelAtrEntity()) { Staff s = db.Staffs.Find(id); return(View(s)); } }
public ActionResult DetailsPosition(int id) { using (HotelAtrEntity db = new HotelAtrEntity()) { Position p = db.Positions.Find(id); return(View(p)); } }
public ActionResult DeleteStaff(int id) { using (HotelAtrEntity db = new HotelAtrEntity()) { Staff s = db.Staffs.Find(id); db.Staffs.Remove(s); db.SaveChanges(); return(RedirectToAction("StaffList")); } }
public ActionResult DeletePosition(int id) { using (HotelAtrEntity db = new HotelAtrEntity()) { Position p = db.Positions.Find(id); db.Positions.Remove(p); db.SaveChanges(); return(RedirectToAction("PositionList")); } }
public ActionResult RoomList() { List <Room> rooms = new List <Room>(); using (HotelAtrEntity db = new HotelAtrEntity()) { rooms = db.Rooms.ToList(); } return(View(rooms)); }
public ActionResult AddStaff(Staff staff) { if (ModelState.IsValid) { using (HotelAtrEntity db = new HotelAtrEntity()) { db.Staffs.Add(staff); db.SaveChanges(); } return(RedirectToAction("StaffList")); } return(View(staff)); }
public ActionResult AddPosition(Position position) { if (ModelState.IsValid) { using (HotelAtrEntity db = new HotelAtrEntity()) { db.Positions.Add(position); db.SaveChanges(); } return(RedirectToAction("PositionList")); } return(View(position)); }
public ActionResult EditStaff(Staff staff) { if (ModelState.IsValid) { using (HotelAtrEntity db = new HotelAtrEntity()) { Staff s = db.Staffs.Find(staff.StaffId); s.StaffId = staff.StaffId; //db.Entry(p).State=EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("StaffsList")); } return(View(staff)); }
public ActionResult EditPosition(Position position) { if (ModelState.IsValid) { using (HotelAtrEntity db = new HotelAtrEntity()) { Position p = db.Positions.Find(position.PositionId); p.PositionName = position.PositionName; //db.Entry(p).State=EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("PositionList")); } return(View(position)); }
public ActionResult EditStaff(int id) { using (HotelAtrEntity db = new HotelAtrEntity()) { Staff staff = db.Staffs.Find(id); List <SelectListItem> PositionList = db.Positions .Select(s => new SelectListItem { Text = s.PositionName, Value = s.PositionId.ToString(), Selected = staff.PositionId == s.PositionId?true:false }).ToList(); ViewBag.PositionList = PositionList; return(View(staff)); } }
public ActionResult RoomList() { //var Browser = HttpContext.Request.; List <Room> rooms = new List <Room>(); using (HotelAtrEntity db = new HotelAtrEntity()) { rooms = db.Rooms.ToList(); } TempData["roomsCount"] = rooms.Count; HttpCookie c = new HttpCookie("id"); c.Value = rooms.Count.ToString(); HttpContext.Response.Cookies.Add(c); return(View(rooms)); }
public ActionResult AddRoomType(RoomType roomType, string Action) { if (Action == "add") { using (HotelAtrEntity db = new HotelAtrEntity()) { db.RoomTypes.Add(roomType); //db.SaveChanges(); } } else if (Action == "edit") { using (HotelAtrEntity db = new HotelAtrEntity()) { RoomType rt = db.RoomTypes.Find(roomType.RoomTypeId); db.Entry(rt).State = EntityState.Modified; db.SaveChanges(); } } //RoomType rt = new RoomType(); //rt.Name = "Double room"; //rt.RoomTypeDescription = "Some XDescription (Double room)"; //List<SelectListItem> lists = new List<SelectListItem>(); //lists.Add(new SelectListItem() //{ // Text = "Almaty", Value = "ALA" //}); //lists.Add(new SelectListItem() //{ // Text = "Astana", Value = "TSN", // Selected = true //}); //ViewBag.ContryList = lists; return(View(roomType)); }
public ActionResult RoomDetails(int id) { //&_SERVER string roomsCount = HttpContext.Response.Cookies["id"].Value; Room room = null; using (HotelAtrEntity db = new HotelAtrEntity()) { room = db.Rooms.FirstOrDefault(f => f.RoomId == id); } //ViewBag.Test = ""; //ViewData["Room"] = room; //TempData["roomsCount"]=""; if (id == 100) { //Обычные страницы в нете return(Redirect("http://google.com")); } if (id == 101) { //Обычные страницы в которые лежат в проекте return(RedirectPermanent("/Account/Login")); } if (room != null) { return(View(room)); } else { //перенаправление на метод действия return(RedirectToAction("RoomList")); } }