示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            FloorTemplate floor = context.Floors.Single(x => x.ID == id);

            context.Floors.Remove(floor);
            context.SaveChanges();
            return(RedirectToAction("Edit", "Plans", new { id = floor.PlanID }));
        }
示例#2
0
 public ActionResult Edit(FloorTemplate floor)
 {
     if (ModelState.IsValid)
     {
         context.Entry(floor).State = EntityState.Modified;
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(floor));
 }
示例#3
0
        public ActionResult Create(FloorTemplate floor)
        {
            if (ModelState.IsValid)
            {
                context.Floors.Add(floor);
                context.SaveChanges();

                return(RedirectToAction("Edit", new { id = floor.ID }));
            }

            return(View(floor));
        }
示例#4
0
        public ActionResult CreateBlank(int planId)
        {
            using (var dtx = new HeimContext()) {
                int?floorNumber = dtx.Floors.Where(f => f.PlanID == planId).Max(f => (int?)f.FloorNumber);

                var floor = new FloorTemplate {
                    PlanID      = planId,
                    FloorNumber = floorNumber.HasValue? +floorNumber.Value + 1: 1
                };

                dtx.Floors.Add(floor);
                dtx.SaveChanges();

                return(RedirectToAction("Edit", new { id = floor.ID }));
            }
        }
示例#5
0
        //
        // GET: /Floors/Details/5

        public ViewResult Details(int id)
        {
            FloorTemplate floor = context.Floors.Single(x => x.ID == id);

            return(View(floor));
        }