Ejemplo n.º 1
0
 // POST api/<controller>
 public SemanticNetwork Post([FromBody] SemanticNetwork semNetwork)
 {
     if (semNetwork != null)
     {
         _context.SemanticNetworks.Add(semNetwork);
         _context.SaveChanges();
         return(semNetwork);
     }
     else
     {
         throw new Exception("Пустое имя сем. сети.");
     }
 }
Ejemplo n.º 2
0
        // POST api/<controller>
        public VertexView Post([FromBody] Vertex vertex)
        {
            var semNetwork = _context.SemanticNetworks.FirstOrDefault(x => x.SemanticNetworkId == vertex.SemanticNetworkId);

            if (semNetwork == null)
            {
                throw new Exception("Семантическои сети с таким id не существует");
            }

            _context.Vertices.Add(vertex);
            _context.SaveChanges();

            return(new VertexView(vertex));
        }
Ejemplo n.º 3
0
        // POST api/<controller>
        public ArcView Post([FromBody] Arc arc)
        {
            var semNetwork = _context.SemanticNetworks.FirstOrDefault(x => x.SemanticNetworkId == arc.SemanticNetworkId);

            if (semNetwork == null)
            {
                throw new Exception("Семантическои сети с таким id не существует");
            }

            _context.Arcs.Add(arc);
            _context.SaveChanges();

            return(new ArcView(arc));
        }