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