Esempio n. 1
0
        public static AccommodationModel PrikaziAccomodationPoSifri(int sifra)
        {
            using (Entities dbEntiti = new Entities())
            {
                AccommodationModel smestaj = (from a in dbEntiti.Accommodations
                                              where a.AccommodationID == sifra
                                              select new AccommodationModel {
                    AccommodationID = a.AccommodationID, Name = a.Name, AccCategoryID = a.AccCategoryID, Name1 = a.AccCategory.Name, CityID = a.CityID, CityName = a.City.CityName, Address = a.Address, Phone = a.Phone, Email = a.Email, Description = a.Description
                }).Single();


                return(smestaj);
            }
        }
Esempio n. 2
0
        public static AccommodationModel InfoAboutAcc(int id)
        {
            using (Entities db = new Entities())
            {
                AccommodationModel info = (from a in db.Accommodations
                                           where (a.AccommodationID == id)
                                           select new AccommodationModel {
                    AccommodationID = a.AccommodationID, Name = a.Name, AccCategoryID = a.AccCategoryID, Address = a.Address, CityID = a.CityID, CityName = a.City.CityName, Description = a.Description, Email = a.Email, Phone = a.Phone, Name1 = a.AccCategory.Name, prosek = null
                }).SingleOrDefault();
                int?proveridaliimastarrating = (from b in db.AccFeedbacks where b.AccommodationID == id select b.StarRating).FirstOrDefault();
                if (proveridaliimastarrating != 0)
                {
                    info.prosek = Admin.ProsekOcena(id);
                }


                return(info);
            }
        }