Ejemplo n.º 1
0
 public VenueMetadata Store(VenueMetadata metadata, HttpPostedFileBase mainImage)
 {
     session.Store(metadata);
     if (mainImage != null)
     {
         documentStore.DatabaseCommands.PutAttachment(metadata.Id + "/mainImage", null, mainImage.InputStream.ReadFully(),
             RavenJObject.FromObject(
             new
             {
                 Filename = metadata.MainImageName
             }
             ));
     }
     session.SaveChanges();
     return metadata;
 }
Ejemplo n.º 2
0
 public ResourceResult Post(EditVenueUrl url, VenueViewModel input)
 {
     var result = new VenueMetadata
                        {
                            Id = input.Id,
                            VenueName = url.VenueName,
                            MainImageName = input.MainImage == null ? input.MainImageName : url.VenueName + "." + input.MainImage.FileName.Split('.').Last(),
                            BarAndClubReviewsUrl = input.BarAndClubReviewsUrl.EnsureHttp(),
                            ContactDetail = new ContactDetail
                                                {
                                                    EmailAddress = input.EmailAddress,
                                                    MainPhoneNumber = input.MainPhoneNumber,
                                                    PostCode = input.PostCode,
                                                    Website = input.Website.EnsureHttp(),
                                                    AddressLines = input.AddressLines ?? new string[] { },
                                                    ContactName = input.ContactName,
                                                    SecondaryPhoneNumbers = input.SecondaryPhoneNumbers ?? new string[] { }
                                                },
                            MapCoords = new GoogleMapCoords
                                            {
                                                Lat = input.Lat,
                                                Long = input.Long
                                            }
                        };
     metadata.Store(result, input.MainImage);
     return SeeOther(new VenuesUrl());
 }