コード例 #1
0
        /// <summary>
        /// Update the database with new user information
        /// </summary>
        /// <param name="user"></param>
        public void UpdateUser(User user)
        {
            var oldEntity     = _context.Users.Find(user.UserID);
            var updatedEntity = Mapper.MapUsers(user);

            _context.Entry(oldEntity).CurrentValues.SetValues(updatedEntity);
        }
コード例 #2
0
        public void UpdateComment(Comment newComment)
        {
            var newEntity = Mapper.MapComments(newComment);
            var oldEntity = _context.Comments.Find(newComment.CommentId);

            _context.Entry(oldEntity).CurrentValues.SetValues(newEntity);
        }