Пример #1
0
        ////////////////Annotations


        public AnnotationsDTO AddAnnotation(int primaryKey, string text, int from, int to)
        {
            using (var db = new SovaContext()) {
                Annotations a = new Annotations();
                a.MarkedPostId = primaryKey;
                a.Annotation   = text;
                a.From         = from;
                a.To           = to;
                db.Add(a);
                db.SaveChanges();

                return(new AnnotationsDTO(a.AnnotationId, a.MarkedPostId, a.Annotation, null, a.From, a.To));
            }
        }
Пример #2
0
        public void Create(Notes note)
        {
            SovaContext db  = new SovaContext();
            var         tmp = db.Notes.ToList();

            if (tmp.Count == 0)
            {
                note.Id = 1;
            }
            else
            {
                note.Id = db.Notes.Max(x => x.Id) + 1;
            }
            db.Add(note);
            db.SaveChanges();
        }
Пример #3
0
        public void CreateMarking(Marking marking)
        {
            SovaContext db      = new SovaContext();
            var         tmpList = db.Markings.ToList();

            if (tmpList.Count == 0)
            {
                marking.Id = 1;
            }
            else
            {
                marking.Id = db.Markings.Max(x => x.Id) + 1;
            }
            db.Add(marking);
            db.SaveChanges();
        }