public AddImportNotificationCommentsHandlerTests()
        {
            this.repo = A.Fake <IImportNotificationCommentRepository>();

            A.CallTo(() => repo.Add(A <ImportNotificationComment> .Ignored)).Returns(Task.FromResult(true));
            this.message = A.Fake <AddImportNotificationComment>();
            this.handler = new AddImportNotificationCommentHandler(this.repo);
        }
Пример #2
0
        public async Task <ActionResult> Add(AddCommentsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.ModelIsValid = false;
                return(View(model));
            }

            var request = new AddImportNotificationComment(model.NotificationId, User.GetUserId(), model.Comment, model.ShipmentNumber.GetValueOrDefault(), DateTime.Now);

            await this.mediator.SendAsync(request);

            return(RedirectToAction("Index", new { id = model.NotificationId, type = model.SelectedType }));
        }