Ejemplo n.º 1
0
 public FavoriteServiceTests()
 {
     this.service = new FavoriteService();
     service.Add(new Favorite { Name = "Pie" }
         );
     service.Add(new Favorite { Name = "Cake" }
         );
 }
Ejemplo n.º 2
0
 public FavoriteServiceTests()
 {
     this.service = new FavoriteService();
     service.Add(new Favorite {
         Name = "Pie"
     }
                 );
     service.Add(new Favorite {
         Name = "Cake"
     }
                 );
 }
Ejemplo n.º 3
0
        public IActionResult Register(UserForRegister userForRegister)
        {
            var userExists = _authService.UserExists(userForRegister.Email);

            if (!userExists.Success)
            {
                return(BadRequest(userExists.Message));
            }
            var registerResult = _authService.Register(userForRegister, userForRegister.Password);

            _basketService.Add(new Basket {
                UserId = registerResult.Data.Id
            });
            _favoriteService.Add(new Favorite {
                UserId = registerResult.Data.Id
            });

            var result = _authService.CreateAccessToken(registerResult.Data);

            if (result.Success)
            {
                return(Ok(result.Data));
            }
            return(BadRequest(result.Message));
        }
        public ActionResult AddClassifyToFavorites(Guid UserId, int Id)
        {
            InputFavoriteDto dto = new InputFavoriteDto();

            dto.ClassifyId = Id;

            var g = _ifavoriteService.Add(dto, UserId);

            return(RedirectToAction("FavoriteClassify", new { UserId = UserId }));
        }
        public async Task <IActionResult> Add(Favorite favorite)
        {
            var result = await _favoriteService.Add(favorite);

            if (result.Success)
            {
                return(Ok(result));
            }

            return(BadRequest(result));
        }
Ejemplo n.º 6
0
        public int Add(InputFavoriteDto dto)
        {//LanguageHelper Language,
            if (!_FavoriteService.IsClassifyIdExist_ForThisUser_InFavorite(getCurrentUserGuid(), dto.ClassifyId))
            {
                return(_FavoriteService.Add(dto, getCurrentUserGuid()));
            }

            throw new HttpResponseException(NotFoundMessage(FavoriteResource.Classify_is_added));

            // return _languageService.Add(dto);
        }
Ejemplo n.º 7
0
        public void AddTest()
        {
            var name        = Guid.NewGuid().ToString();
            var NewFavorite = new Favorite
            {
                Name = name
            };
            var AddedFavorite = service.Add(NewFavorite);

            Assert.IsNotNull(AddedFavorite);
            Assert.IsTrue(AddedFavorite.Id > 0);
            Assert.AreEqual(AddedFavorite.Name, name);
        }