Exemple #1
0
        public int AddDatum(Datum datum)
        {
            datum.DateCreated = DateTime.Now;

            _db.Data.Add(datum);
            return(_db.SaveChanges());
        }
Exemple #2
0
        public int AddEdge(Edge edge)
        {
            _db.Edges.Add(edge);
            var breakpoint = 0;

            return(_db.SaveChanges());
        }
        public void AddResources(IEnumerable <Resource> resources)
        {
            bool containsDirtyInputs = resources.Any(
                resource => SanitizerService.InputsNeedSanitizing(new[]
            {
                resource.Name,
                resource.Description
            })
                );

            if (containsDirtyInputs)
            {
                return;
            }
            using (var db = new dotRDbEntities())
            {
                db.Resources.AddRange(resources);
                db.SaveChanges();
            }
        }
        public void AddResource(Resource resource)
        {
            if (resource.Name == null)
            {
                return;
            }
            var myNode = new Node
            {
                NodeTypeId = NodeTypes.Resource
            };

            _db.Nodes.Add(myNode);
            var savedResource = new Resource
            {
                Name        = SanitizerService.SanitizeForSql(resource.Name),
                Description = SanitizerService.SanitizeForSql(resource.Description),
                Node        = myNode
            };

            _db.Resources.Add(savedResource);
            _db.SaveChanges();
        }