Esempio n. 1
0
        /// <summary>
        /// Upload photo to event.
        /// </summary>
        /// <param name="picturePath"></param>
        /// <param name="eventId"></param>
        /// <param name="userEmail"></param>
        public void UploadPhoto(System.IO.Stream photo, int eventId, string userEmail)
        {
            Pictures picture   = new Pictures();
            string   eventName = GetEventName(eventId);

            picture.Picture_Path = _photoUploader.UploadPhoto(photo, eventName, Guid.NewGuid().ToString());
            picture.Event_Id     = eventId;
            picture.User_Email   = userEmail;

            // Add to db
            lock (_photosEntity)
            {
                _photosEntity.Pictures.Add(picture);
            }

            _photosEntity.SaveChanges();
        }