Esempio n. 1
0
        public async Task <IActionResult> PostMaterialOption(string material_id, IEnumerable <MaterialOptionDTO> options)
        {
            if (options.Count() == 0)
            {
                return(Ok());
            }

            var materialId = int.Parse(material_id);

            if (!await _flyContext.Materials.AnyAsync(x => x.Id == materialId))
            {
                return(NotFound());
            }

            _materialsRepo.AddMaterialOptions(materialId, options);

            await _materialsRepo.SaveChangesAsync();

            return(CreatedAtAction("GetMaterial", new { id = material_id }));
            //return Ok();
        }