Exemplo n.º 1
0
        public ActionResult CreateLevel(Models.LevelCreateModel model)
        {
            var stockwerk = Db.Levels.SingleOrDefault(x => x.Stockwerke.Equals(model.Stockwerk));


            if (stockwerk == null)
            {
                // wenn es das Stockwerk nicht gibt, dann anlegen
                stockwerk = new Level
                {
                    Stockwerke = model.Stockwerk,
                };
                Db.Levels.Add(stockwerk);
                Db.SaveChanges();
            }

            var curr = new Level
            {
                Stockwerke = model.Stockwerk,
                Plan       = model.Plan,
                Rooms      = model.Räume,
            };

            Db.Levels.Add(curr);
            Db.SaveChanges();


            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult EditLevel(Models.LevelCreateModel model)
        {
            var stockwerk = Db.Levels.SingleOrDefault(x => x.Stockwerke.Equals(model.Stockwerk));

            var b = Db.Levels.FirstOrDefault(x => x.Stockwerke.Equals(model.Stockwerk));

            b.Stockwerke = model.Stockwerk;

            Db.SaveChanges();



            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateLevel()
        {
            var model = new Models.LevelCreateModel();

            return(View(model));
        }