Example #1
0
 public ActionResult AƱadirAlbum(string photo)
 {
     var tio = (from usu in adb.Usuarios
                where usu.Alias == (string)Session["usuario"]
                select usu.Nombre).Single();
     bool esta = (from alb in adb.Albums
                  where alb.Nombre_Foto == photo + ".jpg" && alb.Nombre_Usu == tio
                  select true).SingleOrDefault();
     if (esta == false)
     {
         var query = (from ph in adb.Fotos
                      where ph.Nombre == photo + ".jpg"
                      select ph.Nombre).Single();
         Album nuevo = new Album();
         nuevo.Nombre_Foto = query;
         nuevo.Nombre_Usu = tio;
         adb.Albums.InsertOnSubmit(nuevo);
         try
         {
             adb.SubmitChanges();
         }
         catch
         {
             throw;
         }
         return RedirectToAction("Index");
     }
     else
     {
         return RedirectToAction("Album");
     }
 }
		private void detach_Albums(Album entity)
		{
			this.SendPropertyChanging();
			entity.Usuario = null;
		}
		private void attach_Albums(Album entity)
		{
			this.SendPropertyChanging();
			entity.Usuario = this;
		}
 partial void DeleteAlbum(Album instance);
 partial void UpdateAlbum(Album instance);
 partial void InsertAlbum(Album instance);