Пример #1
0
        public void AddPicture(AddPictureInput input)
        {
            if (input != null)
            {
                var picture = new Picture
                {
                    PictureName = input.PictureName,
                    Tags = input.Tags,
                    Description = input.Description,
                    DateAdded = DateTime.Now,
                    PictureMimeType = input.PictureMimeType,
                    PictureData = input.PictureData
                };

                if (input.UserId.HasValue)
                {
                    var user = new User { 
                        Id = input.UserId.Value
                    };

                    picture.AssignedUser = user;
                }
               
                _pictureRepository.Insert(picture);
            }
        } 
Пример #2
0
        public void AddComment(AddCommentInput input)
        {
            if (input != null)
            {
                var comment = new Comment
                {
                    Text = input.Text
                };

                if (input.UserId.HasValue)
                {
                    var user = new User
                    {
                        Id = input.UserId.Value
                    };

                    comment.AssignedUser = user;
                } 

                if (input.PictureId.HasValue)
                {
                    var picture = new Picture
                    {
                        Id = input.PictureId.Value
                    };

                    comment.AssignedPicture = picture;
                }

                _commentRepository.Insert(comment);
            }
        }
Пример #3
0
        public void AddUser(AddUserInput input)
        {
            if (input != null)
            {
                var user = new User
                {
                    Login = input.Login,
                    Password = input.Password,
                };
                

                _userRepository.Insert(user);
                Logon(input);
                
               /* return new GetUsersInput
                {
                    User = Mapper.Map<UserDto>(user)
                }; */
            }
            
        }