Beispiel #1
0
        public ActionResult MyBeers()
        {
            var userId = User.Identity.GetUserId();
            var user   = db.PatronClients.Where(p => p.UserId == userId).FirstOrDefault();
            var bList  = new BeerCollection();

            ViewBag.PrevPicks = user.PrevPicks;
            return(View());
        }
 public BeerCollection AddBeer(string name, int type, int rating)
 {
     try
     {
         using (BeerCollectionEntities db = new BeerCollectionEntities())
         {
             var beer = new BeerCollection()
             {
                 NAME   = name,
                 RATING = rating,
                 TYPE   = type
             };
             db.BeerCollections.Add(beer);
             if (db.SaveChanges() > 0)
             {
                 return(beer);
             }
         }
     }
     catch (Exception ex)
     {
     }
     return(new BeerCollection());
 }