Exemple #1
0
        public void CheckValidateModel_WithoutErrors_ErrorHandlerIsCompletedTrue()
        {
            // arrange
            var statusMessage = errorHandlerFactory.NewErrorHandler(new Problem
            {
                Entity = "Technological procces."
            });

            // act
            var actual = logicValidation.ValidateModel(statusMessage, new ModelStateDictionary());

            // assert
            Assert.True(actual.IsCompleted);
        }
Exemple #2
0
        public async Task <IActionResult> AddSingleItem(Operation model)
        {
            var statusMessage = await logicValidation.CheckAddDataModelAsync(model);

            logicValidation.ValidateModel(statusMessage, ModelState);
            if (statusMessage.IsCompleted)
            {
                var operation = await logic.AddDataModelAsync(model);

                await logProvider.AddToLogAsync($"Added new operation (Id: {operation.Id}).");

                return(RedirectToRoute(TransactionsRouting.SingleItem, new { key = model.TransactionId }));
            }
            else
            {
                return(View("CustomError", statusMessage));
            }
        }