public NoteModel(string content, string city, float latitude, float longitude, string email, string userId) { Id = string.Concat("note_", DateTime.UtcNow.Ticks.ToString()); UserId = userId; IEnumerable <string> removedTags; IEnumerable <string> newTags; SetNoteContents(content, out removedTags, out newTags); foreach (string tag in newTags) { TransactionModel.AddTransaction(userId, TransactionModel.TransactionType.Add, tag, city, latitude, longitude, Id); } CreatedTime = DateTime.UtcNow; LastUpdatedTime = CreatedTime; City = new HashSet <string>(); if (!string.IsNullOrEmpty(city)) { City.Add(city.ToLowerInvariant()); } Completed = false; Location = new Point(longitude, latitude); // Performs special actions on note if applicable new ActionRunner().RunActions(email, DateTime.UtcNow, content, city); }
public static bool AddTransaction(string userId, TransactionType type, string tag, string city, Point location, string noteId = "") { TransactionModel transaction = new TransactionModel(userId, type, tag, city, location, noteId); return(CosmosDBClient.Insert(transaction)); }