public Defect EditDefect(Defect defect)
 {
     BugSquasherDB bsDB = new BugSquasherDB();
     bsDB.Entry(defect).State = System.Data.Entity.EntityState.Modified;
     bsDB.SaveChanges();
     return defect;
 }
        public Activity SaveActivity(Activity activity)
        {
            activity.title = "title";

            BugSquasherDB bsDB = new BugSquasherDB();
            bsDB.Activities.Add(activity);
            bsDB.SaveChanges();
            return activity;
        }
        public Defect SaveDefect(Defect defect)
        {
            defect.dateSubmitted = DateTime.Now;

            BugSquasherDB bsDB = new BugSquasherDB();
            bsDB.Defects.Add(defect);
            bsDB.SaveChanges();
            return defect;
        }
        //maybe split out into a comment business layer
        public Comment SaveComment(Comment comment)
        {
            comment.dateSubmitted = DateTime.Now;

            BugSquasherDB bsDB = new BugSquasherDB();
            bsDB.Comments.Add(comment);
            bsDB.SaveChanges();
            return comment;
        }
 protected bool IsUserExist(object value)
 {
     BugSquasherDB bsDB = new BugSquasherDB();
     return (bsDB.Users.Where(x => x.username == value.ToString()).Count() > 0);
 }
 public List<ApplicationUser> GetAllAccounts()
 {
     BugSquasherDB bsDB = new BugSquasherDB();
     return bsDB.Users.ToList();
 }
 public List<Comment> GetDefectComments(int defectId)
 {
     BugSquasherDB bsDB = new BugSquasherDB();
     List<Comment> lstComments = bsDB.Comments.Where(x => x.defectId == defectId).ToList();
     return lstComments;
 }
 public Defect GetDefect(int defectId)
 {
     BugSquasherDB bsDB = new BugSquasherDB();
     Defect defect = bsDB.Defects.Find(defectId);
     return defect;
 }
 public List<Defect> GetAllDefects()
 {
     BugSquasherDB bsDB = new BugSquasherDB();
     return bsDB.Defects.ToList();
 }