public ActionResult Delete(DetailUser user) { try { if (ModelState.IsValid) { UserBase userDelete = DataBase.Users.Get(p => p.UserId == user.UserId, includeProperties: "UserRole").SingleOrDefault(); if (userDelete.IsPrivate) { return(RedirectToAction("Index")); } DataBase.Users.Delete(userDelete); List <UserRoleBase> useRole = userDelete.UserRole.ToList(); foreach (var roleBase in useRole) { DataBase.UserRoles.Delete(roleBase); } DataBase.Save(); return(RedirectToAction("Index")); } }catch { this.AddDefaultErrorMessage(); } return(View(user)); }
public int Update(DetailUser detailUser) { return(__sqlMapper.Execute(new RequestContext { Scope = "DetailUser", SqlId = "Update", Request = detailUser })); }
public long Save(DetailUser detailUser) { return(__sqlMapper.ExecuteScalar <long>(new RequestContext { Scope = "DetailUser", SqlId = "Insert", Request = detailUser })); }
public ApiResponse <DetailUser> FindById(long id) { ApiResponse <DetailUser> apiResponse = ApiResponse <DetailUser> .GetInstance(); try { DetailUser detailUser = __detailUserDao.FindById(id); apiResponse.Success(detailUser); } catch (System.Exception) { throw; } return(apiResponse); }
public ApiResponse <bool> Update(DetailUser detailUser) { ApiResponse <bool> apiResponse = ApiResponse <bool> .GetInstance(); if (null == detailUser) { return(apiResponse.Error()); } try { __detailUserDao.Update(detailUser); apiResponse.Success(true); } catch (System.Exception) { throw; } return(apiResponse); }
public ApiResponse <long> Save(DetailUser detailUser) { ApiResponse <long> apiResponse = ApiResponse <long> .GetInstance(); if (null == detailUser) { return(apiResponse.Error()); } try { long id = __detailUserDao.Save(detailUser); apiResponse.Success(id); } catch (System.Exception) { throw; } return(apiResponse); }
public ApiResponse <bool> Update(DetailUser detailUser) { return(__detailUserService.Update(detailUser)); }
public ApiResponse <long> Save(DetailUser detailUser) { return(__detailUserService.Save(detailUser)); }
public void FindByIdTest() { DetailUser detailUser = detailUserDaoImpl.FindById(2); Assert.True(null != detailUser); }