Exemplo n.º 1
0
 /// <summary>
 /// Returns the details of the given user.
 /// </summary>
 /// <param name="userName">Name of the user.</param>
 /// <returns>The details of the user.</returns>
 public static User GetUser(string userName)
 {
     // If there is a user logged in, return the record
     if (StringHelper.IsNonBlank(userName))
     {
         return(_userDao.GetFirst("UserName", userName));
     }
     // If no user, return null
     return(null);
 }
        public void TestEditReplacesImage()
        {
            var orig   = new byte[10];
            var update = new byte[42];

            var comment = Comment.AddComment("NL00x", org1, CommentAccessLevel.Public, "JOHN RAMBO", null);

            comment.Update(org1, null, update, false);
            var updatedComment = _commentDao.GetFirst("Id", comment.Id);

            Assert.AreEqual(42, updatedComment.Image.Length, "New image failed to save");
        }
        /// <summary>
        ///  Delete an organization by id, this has the side effect of
        /// de-activating all users of that organization.
        /// </summary>
        /// <param name="organizationId">The id of the org to delete.</param>
        public static void Delete(int organizationId)
        {
            UserHelper.DeactivateUsersOfOrg(organizationId);
            var org = _orgDao.GetFirst("Id", organizationId);

            org.Active = false;
            _orgWriteDao.Update(org);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns a comment by its Id
        /// </summary>
        /// <param name="commentId"></param>
        /// <returns>Comment or null if not found</returns>
        public static Comment ById(int commentId)
        {
            var user = _dao.GetFirst("Id", commentId);

            if (user == null)
            {
                throw new CommentNotFoundException();
            }
            return(user);
        }
Exemplo n.º 5
0
 public static PdbUploadRevision GetById(int uploadRevisionId)
 {
     return(_urDao.GetFirst("Id", uploadRevisionId));
 }