コード例 #1
0
        public async Task <ActionResult <Typification> > PostTypification(Typification typification)
        {
            _context.typifications.Add(typification);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTypification", new { id = typification.Id }, typification));
        }
コード例 #2
0
        public async Task <IActionResult> PutTypification(int id, Typification typification)
        {
            if (id != typification.Id)
            {
                return(BadRequest());
            }

            _context.Entry(typification).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TypificationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
        public TypificationComponent factoryComponent(Typification typification, bool composite = true)
        {
            TypificationComponent component;

            if (composite)
            {
                component = new Composite();
            }
            else
            {
                component = new Leaf();
            }

            component.Id          = typification.Id;
            component.Name        = typification.Name;
            component.Description = typification.Description;

            return(component);
        }