public bool DeleteAnnotation(Annotation annotation) { using var db = new SOContext(); try { db.Annotations.Remove(annotation); db.SaveChanges(); return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }
public bool DeleteMarking(Marking marking) { using var db = new SOContext(); try { db.Markings.Remove(marking); db.SaveChanges(); return(true); } catch (Exception e) { return(false); throw e; } }
public bool UpdateAnnotation(Annotation annotation) { using var db = new SOContext(); try { var oldAnnotation = db.Annotations.Find(annotation.AnnotationId); oldAnnotation.Body = annotation.Body; db.Annotations.Update(oldAnnotation); db.SaveChanges(); return(true); } catch (Exception e) { return(false); throw e; } }
public User CreateUser(string username, string password, string salt) { using var db = new SOContext(); var user = new User() { Username = username, Password = password, Salt = salt }; try { db.Users.Add(user); db.SaveChanges(); return(user); } catch (Exception e) { return(user); throw e; } }