コード例 #1
0
        public ActionResult <ScreeningDataTable> Post([FromBody] ScreeningDataTable value)
        {
            var  dataObject = Screening.FromApiModel(value);
            Guid newId      = Guid.NewGuid();

            dataObject.Id = newId;
            this.dataContext.Screenings.Add(dataObject);
            this.dataContext.SaveChanges();
            var result = ScreeningDataTable.FromDataModel(
                this.dataContext.Screenings.First(x => x.Id == newId)
                );
            var resultUrl = string.Concat(configuration["SwaggerBaseUrl"], $"/ScreeningDataTable/{newId}");

            return(Created(resultUrl, result));
        }