コード例 #1
0
ファイル: UsersBLTest.cs プロジェクト: AdrianMarinica/Timr
 public void ShouldDeleteUser()
 {
     var bl = new UsersBL();
     bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student);
     bl.DeleteUser("ohgoahrgorei", "ohgoahrgorei");
     User user = bl.GetUser("ohgoahrgorei", "ohgoahrgorei");
     Assert.IsNull(user);
 }
コード例 #2
0
        private void DeleteUser(object sender, EventArgs e)
        {
            var id = (int)ctlUsersDataGridView.SelectedCells[0].OwningRow.Cells[0].Value;

            Users.DeleteUser(id);

            DisplayUsers();
        }
コード例 #3
0
        public ActionResult DeleteUser(int userId)
        {
            var currentuser = users.GetUser().FirstOrDefault(u => u.ID == userId);

            if (currentuser != null)
            {
                users.DeleteUser(currentuser.ID);
            }

            return(RedirectToAction("Index", "User"));
        }
コード例 #4
0
 // DELETE: api/Users/5
 public IHttpActionResult Delete(int id, [FromBody] Users1 user)
 {
     try
     {
         UsersBL.DeleteUser(user);
         return(Ok());
     }
     catch
     {
         return(Conflict());
     }
 }
コード例 #5
0
        public IHttpActionResult DeleteUser(int id)
        {
            ErrorMessage errorMessage = usersBL.DeleteUser(id);

            if (errorMessage.Code == HttpStatusCode.OK)
            {
                return(Ok());
            }

            return(new ResponseMessageResult(Request.CreateErrorResponse(
                                                 errorMessage.Code,
                                                 new HttpError(errorMessage.Message)
                                                 )
                                             ));
        }
コード例 #6
0
 public IHttpActionResult DeleteUser(int id)
 {
     objUsers.DeleteUser(id);
     return(Ok());
 }
コード例 #7
0
ファイル: UsersBLTest.cs プロジェクト: AdrianMarinica/Timr
 public void ShouldInsertUserOnlyOnceAndThenDeleteIt()
 {
     var bl = new UsersBL();
     bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student);
     bool actual = bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student);
     bl.DeleteUser("ohgoahrgorei", "ohgoahrgorei");
     Assert.IsFalse(actual);
     Assert.IsFalse(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei", UserTypes.Student));
 }
コード例 #8
0
ファイル: UsersBLTest.cs プロジェクト: AdrianMarinica/Timr
 public void ShouldValidateUser()
 {
     var bl = new UsersBL();
     bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student);
     Assert.IsTrue(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei", UserTypes.Student));
     Assert.IsFalse(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei111", UserTypes.Student));
     bl.DeleteUser("ohgoahrgorei", "ohgoahrgorei");
     Assert.IsFalse(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei", UserTypes.Student));
 }
コード例 #9
0
        public void DeleteUser(SPAProjectManager.Entities.Users user)
        {
            var userBL = new UsersBL(mockContext);

            userBL.DeleteUser(user);
        }