Exemple #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();
        }
Exemple #2
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);
        }
Exemple #3
0
 public void Remove(Models.Profile profile)
 {
     DAL.Profile profileDAO = db.Profiles.Find(profile.ProfileID);
     db.Profiles.Remove(profileDAO);
     db.SaveChanges();
 }
Exemple #4
0
 public void Add(Models.Profile profile)
 {
     DAL.Profile profileDAL = ConvertUtil.profilemodel2dal(profile);
     db.SaveChanges();
 }