Example #1
0
        public ActionResult Create(Album album)
        {
            if (ModelState.IsValid)
            {
                _db.Albums.Add(album);
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.AlbumTypeID = new SelectList(_db.AlbumTypes, "AlbumTypeID", "Name", album.AlbumTypeID);
            ViewBag.PrivacyLevelId = new SelectList(_db.PrivacyLevels, "PrivacyLevelID", "Name", album.PrivacyLevelId);
            ViewBag.UserID = new SelectList(_db.Users, "UserId", "UserName", album.UserID);
            ViewBag.CampaignID = new SelectList(_db.Campaigns, "CampaignID", "Name", album.CampaignID);
            return View(album);
        }
Example #2
0
 public ActionResult Edit(Album album)
 {
     if (album.UserID != (Guid)Membership.GetUser().ProviderUserKey) { return HttpNotFound(); }
     if (ModelState.IsValid)
     {
         _db.Entry(album).State = EntityState.Modified;
         _db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.AlbumTypeID = new SelectList(_db.AlbumTypes, "AlbumTypeID", "Name", album.AlbumTypeID);
     ViewBag.PrivacyLevelId = new SelectList(_db.PrivacyLevels, "PrivacyLevelID", "Name", album.PrivacyLevelId);
     ViewBag.UserID = new SelectList(_db.Users, "UserId", "UserName", album.UserID);
     ViewBag.CampaignID = new SelectList(_db.Campaigns, "CampaignID", "Name", album.CampaignID);
     return View(album);
 }
		private void attach_Albums(Album entity)
		{
			this.SendPropertyChanging();
			entity.PrivacyLevel = this;
		}
		private void detach_Albums(Album entity)
		{
			this.SendPropertyChanging();
			entity.PrivacyLevel = null;
		}
 partial void UpdateAlbum(Album instance);
 partial void DeleteAlbum(Album instance);
 partial void InsertAlbum(Album instance);
		private void detach_Albums(Album entity)
		{
			this.SendPropertyChanging();
			entity.AlbumType = null;
		}
		private void attach_Albums(Album entity)
		{
			this.SendPropertyChanging();
			entity.AlbumType = this;
		}
		private void detach_Albums(Album entity)
		{
			this.SendPropertyChanging();
			entity.UserProfile = null;
		}
		private void attach_Albums(Album entity)
		{
			this.SendPropertyChanging();
			entity.UserProfile = this;
		}