Example #1
0
        public async void CheckGetCompanyForUpdate_FromEmptyDbTable_ErrorHandlerIsCompletedFalse()
        {
            // arrange
            var company = GetCompany();

            // act
            var statusMessage = await logicValidation.CheckGetSingleUpdateModelAsync(company.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"] = CompaniesRouting.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"] = CompaniesRouting.AddSingleItem;
                return(View("EditSingleItem"));
            }
        }