/// <summary> /// Store a new hashtag in the DB. /// </summary> /// <param name="hashtag">The new Hashtag</param> /// <returns>The new ID</returns> public int AddHashtag(Model.Hashtag hashtag) { hashtag.ID = this.GetLastId() + 1; _db.Hashtags.Add(hashtag); _db.SaveChanges(); return(hashtag.ID); }
/// <summary> /// Add a new entry. /// </summary> /// <param name="entry">Entry to be stored.</param> /// <returns>Returns the same entry stored.</returns> public Model.Entry AddEntry(Model.Entry entry) { int id = this.GetLastId(); entry.ID = id + 1; entry.date = DateTime.Now; _db.Entries.Add(entry); _db.SaveChanges(); return(entry); }