Exemple #1
0
        private async void TestViewModel_OnInitiateTestUpdate(object sender, TestUpdateModel e)
        {
            if (e is null)
            {
                throw new ArgumentNullException(nameof(TestsInsertModel),
                                                "The model passed in for test update is null.");
            }

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

            try
            {
                //call data layer to insert the assay
                var updatedTest = await _assayDataAccess.AssayUpdateAsync(mappedUpdateModel);

                //map the updated model to UI library model
                var mappedUpdateddTest = _mapper.Map <TestModel>(updatedTest);
                //Display inserted or updated test on UI
                DisplayInsertedUpdatedTestOnUI(mappedUpdateddTest);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        public async Task <TestsModel> AssayUpdateAsync(TestUpdateModel assayToUpdate)
        {
            try
            {
                var storedProcedure = "[dbo].[usp_UpdateTestById]";
                var parameters      = new
                {
                    Id               = assayToUpdate.Id,
                    DisciplineId     = assayToUpdate.DisciplineId,
                    Description      = assayToUpdate.Description,
                    SampleTypeId     = assayToUpdate.SampleTypeId,
                    ResultDataTypeId = assayToUpdate.ResultDataTypeId,
                    Mask             = assayToUpdate.Mask,
                    UnitId           = assayToUpdate.UnitId,
                    Reportable       = assayToUpdate.Reportable,
                    Code             = assayToUpdate.Code,
                    DefaultCommented = assayToUpdate.DefaultCommented,
                    SortOrder        = assayToUpdate.SortOrder,
                    PrimaryHeader    = assayToUpdate.PrimaryHeader,
                    SecondaryHeader  = assayToUpdate.SecondaryHeader
                };

                var output = await SelectInsertOrUpdateAsync <TestsModel, dynamic>(storedProcedure, parameters);

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