Beispiel #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));
        }
Beispiel #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());
        }
        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);
        }