Ejemplo n.º 1
0
 public HttpResponseMessage Delete(UserModel user)
 {
     if (_deleteUserCommand.Execute(user))
     {
         return new HttpResponseMessage(HttpStatusCode.OK);
     }
     return new HttpResponseMessage(HttpStatusCode.NotImplemented);
 }
Ejemplo n.º 2
0
        public bool Execute(UserModel user)
        {
            var result = _repo.AddUser(user);

            //could log if user not added ???

            return result;
        }
Ejemplo n.º 3
0
 public HttpResponseMessage Add(UserModel user)
 {
     if (_addUserCommand.Execute(user))
     {
         return new HttpResponseMessage(HttpStatusCode.Created);
     }
     return new HttpResponseMessage(HttpStatusCode.NotImplemented);
 }
Ejemplo n.º 4
0
 public UserModel ToUserModel()
 {
     var m = localUserModel ?? ( localUserModel = new UserModel() );
     m.Gateway = Gateway;
     m.Hash = Hash;
     m.Password = Password;
     m.UserName = UserName;
     return m;
 }
        public void should_ReturnNotImplementedStatus_When_AUserIsNotUpdated()
        {
            var user = new UserModel { FirstName = "FirstName" };
            var expectedStatusCode = new HttpResponseMessage(HttpStatusCode.NotImplemented);
            _mockedEditUserCommand.Stub(c => c.Execute(user)).Return(false);

            var result = _controller.Edit(user);

            Assert.That(result.StatusCode, Is.EqualTo(expectedStatusCode.StatusCode));
        }
        public void should_CallIntoProvider_When_DeleteUserIsCalled()
        {
            var user = new UserModel { FirstName = "FirstName" };

            _mockMongoProvider.Stub(p => p.Delete(user)).Return(true);

            var result = _repo.DeleteUser(user);

            _mockMongoProvider.AssertWasCalled(p => p.Delete(Arg<UserModel>.Is.Equal(user)));
            Assert.That(result, Is.True);
        }
Ejemplo n.º 7
0
        public static User ConvertToDB(UserModel user)
        {
            var newUser = new User {
                First_name = user.First_name,
                Last_name = user.Last_name,
                Email = user.Email,
                Passwrd = user.Passwrd
            };

            return newUser;
        }
        public void should_ReturnCreatedStatus_When_AUserIsAddedSuccessfully()
        {
            var user = new UserModel {FirstName = "FirstName"};
            var expectedStatusCode = new HttpResponseMessage(HttpStatusCode.Created);
            _mockedAddUserCommand.Stub(c => c.Execute(user)).Return(true);


            var result = _controller.Add(user);

           Assert.That(result.StatusCode, Is.EqualTo(expectedStatusCode.StatusCode));
        }
Ejemplo n.º 9
0
 public void Update(UserModel user)
 {
     if(user.UserId == 0)
     {
         CreatedDate = DateTime.Now;
     }
     Username = user.Username;
     Password = user.Password;
     EmailAddress = user.EmailAddress;
     PhoneNumber = user.PhoneNumber;
     TwitterHandle = user.TwitterHandle;
 }
Ejemplo n.º 10
0
        private void populateGameSource(UserModel user, GameSourceResponseModel gameSource)
        {
            var endTime = new DateTime();

            var timeTracker = PageHandler.TimeTracker;
            var time = endTime - timeTracker.StartTime;
            timeTracker.NumOfTimes++;
            timeTracker.TimeValue += time;
              //  PageHandler.DebugUI.lblHowFast.Text = ( "Time Taken: " + ( timeTracker.TimeValue / timeTracker.NumOfTimes ) );
            PageHandler.CodeEditorUI.codeEditor.Information.editor.SetValue(gameSource.Content); /*
                                                 buildSite.CodeEditorUI.codeEditor.Information.editor.SetMarker(0, "<span style=\"color: #900\">&nbsp;&nbsp;</span> %N%");*/
            PageHandler.CodeEditorUI.codeEditor.Information.editor.Refresh();
        }
Ejemplo n.º 11
0
 public bool AddNewUser(UserModel user)
 {
     bool result = false;
     try
     {
         result = userContext.Add(UserConverter.ConvertToDB(user));
     }
     catch (Exception e)
     {
         Logger.Log.Error(e);
     }
     return result;
 }
Ejemplo n.º 12
0
 private void OnUserCreateFn(UserModel user, UserCreateResponse o)
 {
     if (o.Successful)
     {
         myUIManager.ClientInfo.LoggedInUser = user;
         myCreateUIService.CreateSingleton(HomeController.View);
         myScope.SwingAway(SwingDirection.Left, false, null);
     }
     else
     {
         myMessageService.PopupOkay("Bad!", "You no create! It exist! What up!!?", () => { });
     }
 }
Ejemplo n.º 13
0
 public ActionResult SignUp(UserModel newUser)
 {
     if (ModelState.IsValid)
     {
         if (userService.IsEmailUnique(newUser.Email))
         {
             userService.AddNewUser(newUser);
             Logger.Log.Debug("new user " + newUser.Email + " has registered");
             return RedirectToAction("RegisterSuccess", "Account");
         }
         ViewBag.errorMessage = "Email is already in use!";
     }
     return View();
 }
Ejemplo n.º 14
0
        private void OnLoginFn(UserModel user, UserLoginResponse data)
        {
            if (data.Successful)
            {
                myUIManager.ClientInfo.LoggedInUser = user;

                myCreateUIService.CreateSingleton(HomeController.View);
                myScope.SwingAway(SwingDirection.Left, false, null);
            }
            else
            {
                myMessageService.PopupOkay("Bad!", "You no login!", () => { });
            }
        }
Ejemplo n.º 15
0
        public async Task<IHttpActionResult> Register(UserModel userModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            IdentityResult result = await new Authentication { }.RegisterUser(userModel);    
            IHttpActionResult errorResult = GetErrorResult(result);

            if (errorResult != null)
            {
                return errorResult;
            }

            return Ok();
        }
        public async Task<IHttpActionResult> Register(UserModel userModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var result = await authRepository.RegisterUser(userModel);

            var errorResult = GetErrorResult(result);

            if (errorResult != null)
            {
                return errorResult;
            }

            return Ok();
        }
Ejemplo n.º 17
0
 public bool DeleteUser(UserModel user)
 {
     return _repository.Delete(user);
 }
Ejemplo n.º 18
0
 public UserLoginValidator(UserModel user)
 {
     User = user;
 }
Ejemplo n.º 19
0
 private void GetRoomInfo(UserModel user, GetRoomInfoResponse o)
 {
     PopulateGameRoom(o.Room);
 }
Ejemplo n.º 20
0
 private void GetChatLines(UserModel user, ChatMessagesModel o)
 {
     myChatBox.AddChatMessages(o.Messages);
 }
Ejemplo n.º 21
0
 private void GetChatInfo(UserModel user, ChatRoomInfoModel o)
 {
     PopulateChatRoom(o.Info);
 }
 private void OnDeveloperCreateGameReceivedFn(UserModel user, DeveloperCreateGameResponse o)
 {
 }
 private void OnDeveloperUpdateGameReceivedFn(UserModel user, DeveloperUpdateGameResponse o)
 {
     myScope.Model.UpdateStatus = UpdateStatusType.Synced;
     myScope.Apply();
 }
 private void GetChatLines(UserModel user, ChatMessagesModel o)
 {
     myScope.Model.ChatLines.AddRange(o.Messages);
     myScope.Apply();
 }
 private void OnOnGetGamesByUserReceivedFn(UserModel user, GetGamesByUserResponse response)
 {
     myScope.Model.Games = response.Games;
     myScope.Apply();
 }
 private void OnDoesGameNameExistReceivedFn(UserModel user, DoesGameExistResponse o)
 {
 }
Ejemplo n.º 27
0
 public bool AddUser(UserModel user)
 {
     return _repository.Insert(user);
 }
 public void should_CallIntoUserRepositry_When_Invoked()
 {
     var user = new UserModel { FirstName = "FirstName" };
     _command.Execute(user);
     _mockedRepo.AssertWasCalled(r => r.UpdateUser(Arg<UserModel>.Is.Equal(user)));
 }
        void clientDebugManagerService_OnGetDebugLog(UserModel user, DebugGameLogModel o)
        {
            scope.Model.Log.Add(o.Value);
            scope.Apply();

        }
Ejemplo n.º 30
0
 public bool UpdateUser(UserModel user)
 {
     return _repository.Update(user);
 }