Пример #1
0
        public void AddDog(Models.Profile profile, Models.HotDog dog)
        {
            DAL.HotDog hotdogDAL = ConvertUtil.hotdogmodel2dal(dog);

            DAL.Profile profileDAO = db.Profiles.Find(profile.ProfileID);
            profileDAO.HotDogs.Add(hotdogDAL);
            db.SaveChanges();
        }
Пример #2
0
 public static DAL.HotDog hotdogmodel2dal(Models.HotDog model)
 {
     DAL.HotDog dal = new DAL.HotDog()
     {
         HotDogID     = model.HotDogID,
         LastPlaceAte = model.LastPlaceAte,
         LastAte      = model.LastTimeAte,
         Name         = model.HotDogName
     };
     return(dal);
 }
Пример #3
0
        public static DAL.Profile profilemodel2dal(Models.Profile model)
        {
            DAL.Profile dal = new DAL.Profile()
            {
                Bio       = model.Bio,
                HotDogID  = model.FavoriteHotDog.HotDogID,
                Name      = model.Name,
                Picture   = model.Picture,
                ProfileID = model.ProfileID
            };
            //convert the existing dogs
            List <DAL.HotDog> dalDogs = new List <DAL.HotDog>();

            foreach (Models.HotDog modelDog in model.HotDogList)
            {
                DAL.HotDog dalDog = hotdogmodel2dal(modelDog);
                dalDogs.Add(dalDog);
            }
            dal.HotDogs = dalDogs;
            return(dal);
        }