예제 #1
0
        public HttpResponseMessage InsertBestOftheHotel(BestOftheHotel bestOfTheHotel)
        {
            BestOftheHotel tobeInserted = new BestOftheHotel();

            tobeInserted = modelobj.BestOftheHotels.Where(m => m.HotelID == bestOfTheHotel.HotelID && m.MenuItemID == bestOfTheHotel.MenuItemID).FirstOrDefault();
            if (tobeInserted != null)
            {
                int noofSuggestions = tobeInserted.NoofSuggenstions;
                tobeInserted.NoofSuggenstions = noofSuggestions + 1;

                return(Request.CreateResponse(HttpStatusCode.OK, modelobj.SaveChanges()));
            }
            else
            {
                modelobj.BestOftheHotels.Add(bestOfTheHotel);
                return(Request.CreateResponse(HttpStatusCode.OK, modelobj.SaveChanges()));
            }
        }
예제 #2
0
 public ActionResult InsertBestOftheHotel(BestOftheHotel bestOfTheHotel)
 {
     modelobj.BestOftheHotels.Add(bestOfTheHotel);
     return(View(modelobj.SaveChanges()));
 }