Example #1
0
        /// <summary>
        /// Save a new Analysis to the database with the data from a viewmodel.
        /// </summary>
        /// <param name="viewModel">Viewmodel with the new analysis data.</param>
        /// <returns>Id of the newly created Analysis.</returns>
        public int Create(AnalysisViewModel viewModel)
        {
            //Create a new Analysis from the viewmodel
            var analysis = viewModel.ToNewModel();

            Repository.Analyses.Add(analysis);
            Save();

            return(analysis.Id);
        }