public void UnfavoriteHairSalon(FavoriteHairSalonVM favoriteHairSalonVM) { HairSalon hairSalon = unitOfWork.HairSalons.GetHairSalon(favoriteHairSalonVM.HairSalonId); RegisteredUser registeredUser = unitOfWork.RegisteredUsers.Get(favoriteHairSalonVM.RegisteredUser.Id); FavoriteHairSalons favoriteHairSalon = unitOfWork.FavoriteHairSalons.GetFavoriteHairSalonByRegisteredUserAndHairSalon(registeredUser.Id, hairSalon.Id); unitOfWork.FavoriteHairSalons.Remove(favoriteHairSalon); unitOfWork.Complete(); }
public void FavoriteHairSalon(FavoriteHairSalonVM favoriteHairSalonVM) { HairSalon hairSalon = unitOfWork.HairSalons.GetHairSalon(favoriteHairSalonVM.HairSalonId); RegisteredUser registeredUser = unitOfWork.RegisteredUsers.Get(favoriteHairSalonVM.RegisteredUser.Id); FavoriteHairSalons favoriteHairSalon = new FavoriteHairSalons() { HairSalonId = hairSalon.Id, RegisteredUserId = registeredUser.Id }; unitOfWork.FavoriteHairSalons.Add(favoriteHairSalon); unitOfWork.Complete(); }
public async Task <ActionResult> FavoriteHairSalon(int id) { hairSalonApi = new HairSalonApiClient(); RegisteredUser registeredUser = (RegisteredUser)Session["RegisteredUser"]; FavoriteHairSalonVM favoriteHairSalonVM = new FavoriteHairSalonVM() { RegisteredUser = registeredUser, HairSalonId = id }; await hairSalonApi.FavoriteHairSalon(favoriteHairSalonVM); return(RedirectToAction("HairSalonDetails", new { id })); }
public async Task UnfavoriteHairSalon(FavoriteHairSalonVM favoriteHairSalonVM) { StringContent content = GetStringContent(favoriteHairSalonVM); HttpClient request = new HttpClient(); await request.PostAsync($"{ API_URL }/UnfavoriteHairSalon", content); }