/// <summary> /// Initializes a new instance of the <see cref="LocationItemViewModel"/> class. /// </summary> /// <param name="location">The location item.</param> /// <param name="provider">The provider.</param> public LocationItemViewModel(LocationItem location, ContentDataProviderBase provider) : base(location, provider) { this.Address = location.Address; this.City = location.City; this.Region = location.Region; this.PostalCode = location.PostalCode; }
/// <summary> /// Create a location item with specific primary key /// </summary> /// <param name="id">Primary key</param> /// <returns> /// Newly created agent item in transaction /// </returns> public LocationItem CreateLocation(Guid id) { var location = new LocationItem(); location.Id = id; location.ApplicationName = this.ApplicationName; location.Owner = SecurityManager.GetCurrentUserId(); var dateValue = DateTime.UtcNow; location.DateCreated = dateValue; location.PublicationDate = dateValue; ((IDataItem)location).Provider = this; // items with empty guid are used in the UI to get a "blank" data item // -> i.e. to fill a data item with default values // if this is the case, we leave the item out of the transaction if (id != Guid.Empty) { this.GetContext().Add(location); } return location; }
public void DeleteLocation(LocationItem location) { var scope = this.GetContext(); //this.ClearLifecycle(location, this.GetLocations()); if (scope != null) { scope.Remove(location); } }