Beispiel #1
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var picture = new Gallery();
                // TODO: Add insert logic here
                var info = new StringBuilder();
                foreach (string file in Request.Files)
                {
                    HttpPostedFileBase postedFile = Request.Files[file];
                    if (postedFile.ContentLength == 0)
                        continue;
                    var newFileName = Guid.NewGuid() + "-" + postedFile.FileName;
                    string newFilePath = Path.Combine(
                        AppDomain.CurrentDomain.BaseDirectory + @"Content\Gallery\",
                        Path.GetFileName( newFileName )
                    );
                    postedFile.SaveAs( newFilePath );

                    picture.name = Request.Form["name"];
                    picture.filename = newFileName;
                    picture.upload_by = galleryRepository.GetAuthorId( User.Identity.Name );
                    picture.upload_date = DateTime.UtcNow;
                    galleryRepository.Add( picture );
                    galleryRepository.Save();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View( "Error" );
            }
        }
Beispiel #2
0
		private void attach_Galleries(Gallery entity)
		{
			this.SendPropertyChanging();
			entity.Users = this;
		}
Beispiel #3
0
		private void detach_Galleries(Gallery entity)
		{
			this.SendPropertyChanging();
			entity.Users = null;
		}
Beispiel #4
0
 partial void DeleteGallery(Gallery instance);
Beispiel #5
0
 partial void UpdateGallery(Gallery instance);
Beispiel #6
0
 partial void InsertGallery(Gallery instance);
Beispiel #7
0
 public void Delete( Gallery picture )
 {
     db.Galleries.DeleteOnSubmit( picture );
 }
Beispiel #8
0
 public void Add( Gallery picture )
 {
     db.Galleries.InsertOnSubmit( picture );
 }