コード例 #1
0
 public HttpResponseMessage Delete(UserModel user)
 {
     if (_deleteUserCommand.Execute(user))
     {
         return new HttpResponseMessage(HttpStatusCode.OK);
     }
     return new HttpResponseMessage(HttpStatusCode.NotImplemented);
 }
コード例 #2
0
        public bool Execute(UserModel user)
        {
            var result = _repo.AddUser(user);

            //could log if user not added ???

            return result;
        }
コード例 #3
0
 public HttpResponseMessage Add(UserModel user)
 {
     if (_addUserCommand.Execute(user))
     {
         return new HttpResponseMessage(HttpStatusCode.Created);
     }
     return new HttpResponseMessage(HttpStatusCode.NotImplemented);
 }
コード例 #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;
 }
コード例 #5
0
        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));
        }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: UserConverter.cs プロジェクト: vlad94md/team04
        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;
        }
コード例 #8
0
        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));
        }
コード例 #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;
 }
コード例 #10
0
ファイル: CodeEditorUI.cs プロジェクト: noobouse/ShufflySharp
        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();
        }
コード例 #11
0
ファイル: UserService.cs プロジェクト: vlad94md/team04
 public bool AddNewUser(UserModel user)
 {
     bool result = false;
     try
     {
         result = userContext.Add(UserConverter.ConvertToDB(user));
     }
     catch (Exception e)
     {
         Logger.Log.Error(e);
     }
     return result;
 }
コード例 #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!!?", () => { });
     }
 }
コード例 #13
0
ファイル: AccountController.cs プロジェクト: vlad94md/team04
 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();
 }
コード例 #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!", () => { });
            }
        }
コード例 #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();
        }
コード例 #16
0
        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();
        }
コード例 #17
0
 public bool DeleteUser(UserModel user)
 {
     return _repository.Delete(user);
 }
コード例 #18
0
 public UserLoginValidator(UserModel user)
 {
     User = user;
 }
コード例 #19
0
 private void GetRoomInfo(UserModel user, GetRoomInfoResponse o)
 {
     PopulateGameRoom(o.Room);
 }
コード例 #20
0
 private void GetChatLines(UserModel user, ChatMessagesModel o)
 {
     myChatBox.AddChatMessages(o.Messages);
 }
コード例 #21
0
 private void GetChatInfo(UserModel user, ChatRoomInfoModel o)
 {
     PopulateChatRoom(o.Info);
 }
コード例 #22
0
 private void OnDeveloperCreateGameReceivedFn(UserModel user, DeveloperCreateGameResponse o)
 {
 }
コード例 #23
0
 private void OnDeveloperUpdateGameReceivedFn(UserModel user, DeveloperUpdateGameResponse o)
 {
     myScope.Model.UpdateStatus = UpdateStatusType.Synced;
     myScope.Apply();
 }
コード例 #24
0
 private void GetChatLines(UserModel user, ChatMessagesModel o)
 {
     myScope.Model.ChatLines.AddRange(o.Messages);
     myScope.Apply();
 }
コード例 #25
0
 private void OnOnGetGamesByUserReceivedFn(UserModel user, GetGamesByUserResponse response)
 {
     myScope.Model.Games = response.Games;
     myScope.Apply();
 }
コード例 #26
0
 private void OnDoesGameNameExistReceivedFn(UserModel user, DoesGameExistResponse o)
 {
 }
コード例 #27
0
 public bool AddUser(UserModel user)
 {
     return _repository.Insert(user);
 }
コード例 #28
0
 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)));
 }
コード例 #29
0
        void clientDebugManagerService_OnGetDebugLog(UserModel user, DebugGameLogModel o)
        {
            scope.Model.Log.Add(o.Value);
            scope.Apply();

        }
コード例 #30
0
 public bool UpdateUser(UserModel user)
 {
     return _repository.Update(user);
 }