public IActionResult ChangeDescription([FromBody] ChangeDescription changedPresentationSegment) { if (ModelState.IsValid) { var response = this.positionsApplicationService.ChangeDescription(changedPresentationSegment); return(Json(response)); } return(Json(false)); }
public void ChangeDescription() { var product = this.GetProduct(desc: "desc1"); var newDesc = "desc6"; var cmd = new ChangeDescription(newDesc); product.ChangeDescription(cmd); product.Description.Should().Be(newDesc); product.ModifiedDate?.ToString("yyyyMMdd").Should().Be(DateTimeOffset.Now.ToString("yyyyMMdd")); }
public void ChangeDescription(ChangeDescription cmd) { if (new DescriptionSpec(cmd.Description).IsSatisfy() == false) { throw new DescriptionIsEmptyException(); } this.Description = cmd.Description; this.ModifiedDate = DateTimeOffset.Now; this.ApplyEvent(new ProductDescriptionChanged(this.Id, this.Description, this.ModifiedDate.Value)); }
public ChangeDescriptionViewModel(ChangeDescription changeDescription) { this.changeDescription = changeDescription; foreach (var v in ValidComments) { changeDescription.Comments.Add(v.First()); } //Make sure there is always a comment since the last one is used as free comment changeDescription.Comments.Add(""); }
/// <summary> /// Comes here when an entry is deleted from the head observations /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Collection_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.OldItems.Count > 0) { TimestampValue tsv = e.OldItems[0] as TimestampValue; IIntake intake = HeadObservations.Keys[CurrentIntakeIndex]; ChangeDescription c = CVM.ChangeController.GetRemoveWatlevel(intake, tsv.Time); ChangeDescriptionViewModel cv =new ChangeDescriptionViewModel(c); cv.IsDirty = true; cv.IsApplied = true; CVM.AddChange(cv, true); } }
public async Task <IActionResult> ChangeDescription([FromBody] ChangeDescription command) => Json(await _userService.ChangeDescriptionAsync(UserId, command.Description));
private void Apply() { if (IntakeAdded != null) { ChangeDescription cd = CVM.ChangeController.AddIntakeToPlant(IntakeAdded, CurrentPlant.plant); CurrentChange.changeDescription.Action = cd.Action; CurrentChange.changeDescription.ChangeValues = cd.ChangeValues; CurrentChange.changeDescription.PrimaryKeys = cd.PrimaryKeys; } else if (IntakeRemoved != null) { ChangeDescription cd = CVM.ChangeController.RemoveIntakeFromPlant(IntakeRemoved, CurrentPlant.plant); CurrentChange.changeDescription.Action = cd.Action; CurrentChange.changeDescription.ChangeValues = cd.ChangeValues; CurrentChange.changeDescription.PrimaryKeys = cd.PrimaryKeys; } else //Only the dates have been changed { if (StartDateChange != null) { if (StartDateChange.PrimaryKeys.Values.First() == "") //It is a change of change { ChangeDescription cd = CVM.ChangeController.AddIntakeToPlant(CurrentIntake, CurrentPlant.plant); CurrentChange.changeDescription.Action = TableAction.EditValue; CurrentChange.changeDescription.ChangeValues = cd.ChangeValues; CurrentChange.changeDescription.PrimaryKeys = cd.PrimaryKeys; } else { CurrentChange.changeDescription = StartDateChange; } if (EndDateChange != null) { CurrentChange.changeDescription.ChangeValues.Add(EndDateChange.ChangeValues[0]); } } else if (EndDateChange != null) { if (EndDateChange.PrimaryKeys.Values.First() == "") //It is a change of change { ChangeDescription cd = CVM.ChangeController.AddIntakeToPlant(CurrentIntake, CurrentPlant.plant); CurrentChange.changeDescription.Action = TableAction.EditValue; CurrentChange.changeDescription.ChangeValues = cd.ChangeValues; CurrentChange.changeDescription.PrimaryKeys = cd.PrimaryKeys; } else { CurrentChange.changeDescription = EndDateChange; } } } //call distribute extraction again. CurrentPlant.plant.DistributeExtraction(true); CurrentChange.IsDirty = true; CurrentChange.IsApplied = true; CVM.AddChange(CurrentChange, false); CurrentChange = new ChangeDescriptionViewModel(CVM.ChangeController.GetGenericPlantIntake()); IntakeRemoved = null; IntakeAdded = null; EndDateChange = null; StartDateChange = null; CanApply = false; }