Example #1
0
        // GET: Report
        public ActionResult SalesDish()
        {
            var         identity = (System.Web.HttpContext.Current.User as MyIdentity.MyPrincipal).Identity as MyIdentity;
            ReportLocal model    = new ReportLocal();

            model.Restaurants = new SelectList(db.PR_LocalRestaurantInfo(identity.User.IdCard).ToList(), "IdLocal", "Name");
            model.DateStart   = DateTime.Now.AddMonths(-1).ToString("yyyy-M-d");
            model.DateEnd     = DateTime.Now.ToString("yyyy-M-d");
            model.Result      = new List <ReportLocalResult>();
            model.Types       = db.PR_DishTypes().ToList();

            return(View(model));
        }
        public ActionResult CreateTypePerDish(string name)
        {
            Models.Type type = new Models.Type();
            if (!(db.PR_DishTypes().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");
        }