Beispiel #1
0
        public ActionResult Create(string placeId, string beerId, string comment)
        {
            if (placeId == "" || beerId == "" || comment == "")
            {
                return(Content("FAIL"));
            }

            var place = PlaceRepository.Get(placeId);
            var beer  = BeerRepository.Get(beerId);

            var tap = new Tap
            {
                Beer      = beer,
                Place     = place,
                Username  = SessionUser.Current.Username,
                Timestamp = DateTime.Now,
                Comment   = comment
            };

            TapRepository.Create(tap);
            return(Content("OK"));
        }
Beispiel #2
0
 //private DbContext db = new DbContext();
 // GET: api/Beers
 public IQueryable <Beer> GetBeers()
 {
     return(_context.Get());
 }
        public Beer GetOne(int id)
        {
            Demo_API_BeerAPI.DAL.Entities.BeerEntity beerDB = beerRepository.Get(id);

            return(beerDB is null ? null : ConvertBeerDB(beerDB));
        }