Exemple #1
0
 public Annotation AddAnnotation(Annotation annotation)
 {
     using (var db = new SovaContext())
     {
         annotation.AnnotationCreationDate = db.GetTimestamp();
         //annotation.AnnotationId = db.annotation.Max(c => c.AnnotationId) + 1;
         db.Add(annotation);
         db.SaveChanges();
     }
     return(GetAnnotation(annotation.AnnotationId));
 }
Exemple #2
0
        public bool UpdateAnnotation(Annotation annotation)
        {
            using (var db = new SovaContext())

                try
                {
                    annotation.AnnotationCreationDate = db.GetTimestamp();
                    db.Attach(annotation);
                    db.Entry(annotation).State = EntityState.Modified;
                    return(db.SaveChanges() > 0);
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(false);
                }
        }