Пример #1
0
        public async Task CreateUserBadge()
        {
            UserBadge b = new UserBadge {
                Id = 5, UserId = "qwerty", BadgeId = 2
            };
            long bID = await _userBadgeService.CreateUserBadge(b);

            Assert.AreEqual(b.Id, bID);
        }
Пример #2
0
        public async Task <IHttpActionResult> PostUserBadge(UserBadge userBadge)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            userBadge.Id = await _userBadgeService.CreateUserBadge(userBadge);

            return(CreatedAtRoute("DefaultApi", new { id = userBadge.Id }, userBadge));
        }
Пример #3
0
        public IHttpActionResult PostUserBadge(UserBadge ub)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ubsvc.CreateUserBadge(ub);
            uow.Save();

            return(CreatedAtRoute("DefaultApi", new { id = ub.ID }, UserBadgeDto.FromUserBadge(ub)));
        }