示例#1
0
        public override bool Equals(object obj)
        {
            StoredReply sr = obj as StoredReply;

            if (sr == null)
            {
                return(false);
            }

            return(sr.Title == this.Title && sr.Reply == sr.Reply);
        }
            public async Task <int> Handle(CreateStoredReplyCommand request, CancellationToken cancellationToken)
            {
                CleanArchitecture.Domain.Entities.StoredReply sr;
                AppUser user;

                sr = new CleanArchitecture.Domain.Entities.StoredReply
                {
                    Title = request.Title,
                    Reply = request.Reply
                };

                user = _context.User.Include(x => x.StoredReply).FirstOrDefault(x => x.Id == _currentUserService.UserId);
                user.StoredReply.Add(sr);

                await _context.SaveChangesAsync(cancellationToken);

                return(sr.Id);
            }