Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Media"/> class.
 /// </summary>
 public Media()
 {
     Title = string.Empty;
     Description = string.Empty;
     Tags = string.Empty;
     Location = new Location();
 }
 /// <summary>
 /// Saves the specified location.
 /// </summary>
 /// <param name="location">The location.</param>
 public void Save(Location location)
 {
     database.NonQuery("Location_Save", location);
 }
        /// <summary>
        /// Saves the location.
        /// </summary>
        /// <param name="batch">The batch.</param>
        /// <param name="userId">The user id.</param>
        private void SaveLocation(UploadBatch batch, int userId)
        {
            if(!string.IsNullOrEmpty(batch.LocationName) &&
               batch.Latitude.HasValue &&
               batch.Longitude.HasValue &&
               batch.Zoom.HasValue &&
               !string.IsNullOrEmpty(batch.MapTypeId) )
            {
                Location location = new Location
                                        {
                                            LocationName = batch.LocationName,
                                            Latitude = batch.Latitude.GetValueOrDefault(),
                                            Longitude = batch.Longitude.GetValueOrDefault(),
                                            MapTypeId = batch.MapTypeId,
                                            Zoom = batch.Zoom.GetValueOrDefault(),
                                            UserId = userId
                                        };

                _locationRepository.Save(location);
            }
        }