Example #1
0
        public async void CheckGetTransactionForUpdate_FromEmptyDbTable_ErrorHandlerIsCompletedFalse()
        {
            // arrange
            var transaction = GetTransaction();

            // act
            var statusMessage = await logicValidation.CheckGetSingleUpdateModelAsync(transaction.Id);

            // assert
            Assert.False(statusMessage.IsCompleted);
        }
Example #2
0
        public async Task <IActionResult> GetEditSingleItem(string key)
        {
            // add distincted from edit, by presence of key parameter
            // further on they distincted by ViewData[SaveRoute]
            if (key != null)
            {
                int id = Int32.Parse(key);
                ViewData["SaveRoute"] = TransactionsRouting.EditSingleItem;
                var statusMessage = await logicValidation.CheckGetSingleUpdateModelAsync(id);

                if (statusMessage.IsCompleted)
                {
                    var model = await logic.GetSingleUpdateModelAsync(id);

                    return(View("EditSingleItem", model));
                }
                else
                {
                    return(View("CustomError", statusMessage));
                }
            }
            else
            {
                ViewData["SaveRoute"] = TransactionsRouting.AddSingleItem;
                return(View("EditSingleItem"));
            }
        }