public async Task <IActionResult> Insert([FromBody] HistoricalInputViewModel historicalInputViewModel)
        {
            var historicalInputEntity = historicalInputViewModel.ToEntity();
            var historicalEntity      = await historicalsService.Insert(historicalInputEntity);

            var historicalViewModel = historicalEntity.ToViewModel();

            return(StatusCode((int)StatusCodes.Status201Created, historicalViewModel));
        }
Esempio n. 2
0
        public static HistoricalInputEntity ToEntity(this HistoricalInputViewModel viewModel)
        {
            if (viewModel == null)
            {
                return(null);
            }

            var entity = new HistoricalInputEntity
            {
                LeaderId   = viewModel.LeaderId,
                LedId      = viewModel.LedId,
                Occurrence = viewModel.Occurrence,
                Commentary = viewModel.Commentary,
            };

            return(entity);
        }