コード例 #1
0
        public async Task Should_Save_Email()
        {
            var command = EmailFaker.GenerateEmailViewModel().Generate();
            var result  = await _emailAppService.SaveEmail(command);

            result.Should().BeTrue(becauseArgs: _notifications.GetNotificationsByKey());
            _database.Emails.FirstOrDefault(f => f.Type == command.Type).Should().NotBeNull();
        }
コード例 #2
0
        public async Task <ActionResult <EmailViewModel> > UpdateEmail(EmailType type, [FromBody] EmailViewModel command)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(ModelStateErrorResponseError());
            }

            command.Type     = type;
            command.Username = _systemUser.Username;
            await _emailAppService.SaveEmail(command);

            return(ResponsePutPatch());
        }