public void UpdateNotation(NotationModel n) { Notation n1 = db.Notations.Where(i => i.ID == n.ID).FirstOrDefault(); db.Entry(ToNotation(n1, n)).State = EntityState.Modified; db.SaveChanges(); }
public Notation ToNotation(Notation n, NotationModel n1) { n.ID = n1.ID; n.Note = n1.Note; n.Project_ID = n1.Project_ID; n.Author = n1.Author; n.Date = n1.Date; return(n); }
public NotationModel ToNotationModel(Notation n1) { NotationModel n = new NotationModel(); n.ID = n1.ID; n.Note = n1.Note; n.Author = n1.Author; n.AuthorName = db.Employees.Where(i => i.ID == n1.Author).FirstOrDefault().Name; n.Project_ID = n1.Project_ID; n.Date = n1.Date; return(n); }
public void DeleteNotation(NotationModel n) { db.Notations.Remove(db.Notations.Find(n.ID)); }
public void AddNotation(NotationModel n) { db.Notations.Add(ToNotation(new Notation(), n)); }