Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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 }));
        }
Esempio n. 4
0
 public async Task UnfavoriteHairSalon(FavoriteHairSalonVM favoriteHairSalonVM)
 {
     StringContent content = GetStringContent(favoriteHairSalonVM);
     HttpClient    request = new HttpClient();
     await request.PostAsync($"{ API_URL }/UnfavoriteHairSalon", content);
 }