public DiaryItemViewModel() { DiaryItem = new DiaryItem() { Time = DateTime.Now }; }
public ForecastViewModel() { DiaryItem = new DiaryItem() { Time = DateTime.Now }; }
private async Task AddItemsToContainerAsync() { DiaryItem diaryItem = new DiaryItem { UserName = "******", Note = "This is a note from the program", TimeStamp = DateTime.UtcNow.ToString(), Rating = "3", Id = Guid.NewGuid().ToString() }; try { // Read the item to see if it exists. ItemResponse <DiaryItem> diaryItemResponse = await this.container.ReadItemAsync <DiaryItem>(diaryItem.Id, new PartitionKey(diaryItem.UserName)); Console.WriteLine("Item in database with id: {0} already exists\n", diaryItemResponse.Resource.Id); } catch (CosmosException ex) when(ex.StatusCode == HttpStatusCode.NotFound) { ItemResponse <DiaryItem> diaryItemResponse = await this.container.CreateItemAsync <DiaryItem>(diaryItem, new PartitionKey(diaryItem.UserName)); Console.WriteLine("Created item in database with id: {0} Operation consumed {1} RUs.\n", diaryItemResponse.Resource.Id, diaryItemResponse.RequestCharge); } }
public DiaryItemViewModel(Page page) { Page = page; DiaryItem = new DiaryItem() { Time = DateTime.Now }; }
private void Update() { if (notes[notes.Count - 1] != topDiaryItem) { updateLog(); topDiaryItem = notes[notes.Count - 1]; } }
public static DiaryItem CreateDiaryItem(Car car = null, int mileage = 1000, DateTime?timestamp = null) { car ??= VehiclesTestData.CreateCar(); timestamp ??= DateTime.Now; var valid = new DiaryItem(car, mileage, timestamp.Value); /* do magic here with reflection to modify object however you want */ return(valid); }
public void addElement(DiaryItem noteDiary) { if (notes == null) { notes = new List <DiaryItem>(); } notes.Add(noteDiary); if (notes.Count > 30) { notes.RemoveAt(0); } }
public object Clone() { var diaryItem = (DiaryItem)DiaryItem.Clone(); return(new DiaryItemViewModel { DiaryItem = diaryItem, Navigation = this.Navigation, Page = this.Page, DiaryListViewModel = this.DiaryListViewModel }); }
public void Execute(CreateItemCommand command) { if (command == null) { throw new ArgumentNullException("command"); } if (_repository == null) { throw new InvalidOperationException("Repository is not initialized."); } var aggregate = new DiaryItem(command.Id, command.Title, command.Description, command.From, command.To); aggregate.Version = -1; _repository.Save(aggregate, aggregate.Version); }
private void startDiaryLog(string logJorneyID) { //пытаемся получить обьект jorney от контроллера jorney = JorneysController.getJorneyComponentById(logJorneyID); //если обьект был найден - инициализируем для него интерфейс if (jorney != null) { createNotesGUI(jorney.values.diary.notes.Count); notes = jorney.values.diary.notes; topDiaryItem = notes[notes.Count - 1]; updateLog(); } }
public void Execute(CreateItemCommand command) { if (command == null) { throw new Exception(); } if (_repository == null) { throw new Exception(); } var aggregate = new DiaryItem(command.Id, command.Title, command.Description, command.From, command.To); aggregate.Version = -1; _repository.Save(aggregate, aggregate.Version); }
public Task <string> Handle(CreateItemCommand command, CancellationToken token) { if (command == null) { throw new ArgumentNullException(nameof(command)); } if (_repository == null) { throw new InvalidOperationException("Repository is not initialized."); } var aggregate = new DiaryItem(command.Id, command.Title, command.From, command.To, command.Description); aggregate.Version = -1; _repository.Save(aggregate, aggregate.Version); return(Task.FromResult("Ok")); }
public async Task CreateDiaryItem(DiaryItem item) { try { if (string.IsNullOrWhiteSpace(item.Title) || string.IsNullOrWhiteSpace(item.Description)) { throw new Exception("Diary title and description required."); } var queryResult = await _connection.InsertAsync(item).ConfigureAwait(continueOnCapturedContext: false); StatusMessage = $"{queryResult} item added [Title: {item.Title}]"; } catch (Exception ex) { StatusMessage = $"Failed to create item. Error: {ex.Message}"; } }
public DiaryItem Diary([System.Web.Http.FromBody] DiaryItem diaryItem) { var diarys = new DiaryManager(); return(diarys.Add(diaryItem)); }
public DiaryItemViewModel(Page page, DiaryItem diaryItem) { Page = page; DiaryItem = diaryItem; }
public DiaryItem Update([FromBody] DiaryItem item) { var m = new DiaryManager(); return(m.Update(item)); }
public void Delete([FromBody] DiaryItem item) { var m = new DiaryManager(); m.Delete(item.Id); }
public DiaryEvent(DiaryItem item) { throw new NotImplementedException(); }
public void Init(DiaryItem diaryItem = null) { _diaryItem = diaryItem == null ? new DiaryItem() : diaryItem; _diaryItem.Date = _dateProvider.Today(); }
public void setContent(DiaryItem _logContent) { textRef = GetComponentInChildren <TMP_Text>(); textRef.SetText(_logContent.text); }