コード例 #1
0
        /// <summary>
        /// Update the Analysis with the data from the given viewmodel.
        /// </summary>
        /// <param name="viewModel">Viewmodel with the modified data.</param>
        public void Update(AnalysisViewModel viewModel)
        {
            var analysis = Repository.Analyses.SingleOrDefault(a => a.Id == viewModel.Id);

            if (analysis == null)
            {
                return;
            }

            //Update the analysis with the viewmodel data
            viewModel.ToModel(analysis);
            Repository.Entry(analysis).State = EntityState.Modified;

            Save();
        }