Ejemplo n.º 1
0
        private async void TestViewModel_OnInitiateTestInsert(object sender, TestsInsertModel e)
        {
            if (e is null)
            {
                throw new ArgumentNullException(nameof(TestsInsertModel),
                                                "The model passed in for test insert is null.");
            }

            //map the model to data layer model
            var mappedInsertModel = _mapper.Map <DataLibrary.Models.TestsInsertModel>(e);

            try
            {
                //call data layer to insert the assay
                var insertedTest = await _assayDataAccess.InsertTestAsync(mappedInsertModel);

                //map the inserted model to UI library model
                var mappedInsertedTest = _mapper.Map <TestModel>(insertedTest);
                //Display inserted or updated test on UI
                DisplayInsertedUpdatedTestOnUI(mappedInsertedTest);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public async Task <TestsModel> InsertTestAsync(TestsInsertModel assayToInsert)
        {
            try
            {
                var storedProcedure = "[dbo].[usp_InsertTest]";
                var output          = await SelectInsertOrUpdateAsync <TestsModel, TestsInsertModel>(storedProcedure, assayToInsert);

                return(output);
            }
            catch (Exception)
            {
                throw;
            }
        }