Esempio n. 1
0
        public async Task <SampleModel> UpdateSample(string id, [FromBody] SampleModelAttributes model)
        {
            var updatedModel = new SampleModel
            {
                Id   = id,
                Name = model.Name,
            };

            return(updatedModel);
        }
Esempio n. 2
0
        public async Task <ActionResult <SampleModel> > CreateSample([FromBody] SampleModelAttributes model)
        {
            var createdModel = new SampleModel
            {
                Id   = IdGenerator.Generate(),
                Name = model.Name,
            };

            return(CreatedAtAction(nameof(GetSample), new { version = "v1", id = createdModel.Id }, createdModel));
        }