Example #1
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"));
            }
        }
Example #2
0
        public async void GetTransactionBatch_FromInitializedDbTable_LogicTransactionBatchEqualExpectedTransactionBatch()
        {
            // arrange
            var expected = GetTransaction();

            fixture.db.Add(expected);
            await fixture.db.SaveChangesAsync();

            // act
            var actual = await logic.GetSingleUpdateModelAsync(expected.Id);

            // assert
            Assert.NotNull(actual);
            Assert.Equal(expected.Comment, actual.Comment);
            Assert.Equal(expected.IsOpen, actual.IsOpen);
            Assert.Equal(expected.Id, actual.Id);
            Assert.Equal(expected.Date, actual.Date);
            Assert.Equal(expected.CompanyId, actual.CompanyId);
            Assert.Equal(expected.Type, actual.Type);
        }