Пример #1
0
        public ActionResult CreateTypePerRestaurant(string name)
        {
            Models.Type type = new Models.Type();
            if (!(db.PR_RestaurantTypes().Any(o => o.Name == name)) && name != "")
            {
                type.Name = name;
                db.Type.Add(type);
                db.SaveChanges();

                return(Content((type.IdType).ToString()));
            }

            throw new Exception("oh no");
        }
        public ActionResult Index()
        {
            MapView model = new MapView();

            model.Locals = db.Local.Take(100).ToList();
            model.Types  = new List <TypeFilter>();
            foreach (var typeTmp in db.PR_RestaurantTypes().ToList())
            {
                TypeFilter tmp = new TypeFilter();
                tmp.TypeMap     = db.Type.Find(typeTmp.IdType);
                tmp.TypeId      = typeTmp.IdType;
                tmp.CheckFilter = true;
                model.Types.Add(tmp);
            }
            return(View(model));
        }