Exemple #1
0
 public ActionResult Create(NewUserFeedModel newUserFeed)
 {
     if (ModelState.IsValid)
     {
         UserFeed userFeed = new UserFeed
                                 {
                                     ID = Guid.NewGuid(),
                                     Description = newUserFeed.Description,
                                     Filter =
                                         new Filter { ID = Guid.NewGuid(), FilterText = newUserFeed.FilterText },
                                     IsFavourite = newUserFeed.IsFavourite,
                                     IsPublic = newUserFeed.IsPublic,
                                     Title = newUserFeed.Name,
                                     User_ID = Models.User.GetIDByName(User.Identity.Name)
                                 };
         TempData["usrfeed"] = userFeed;
         db.UserFeeds.AddObject(userFeed);
         db.SaveChanges();
         return RedirectToAction("AddRssFeed");
     }
     ViewBag.User_ID = new SelectList(db.Users, "ID", "UserName", newUserFeed.UserId);
     return View(newUserFeed);
 }
Exemple #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the UserFeeds EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserFeeds(UserFeed userFeed)
 {
     base.AddObject("UserFeeds", userFeed);
 }
Exemple #3
0
 public ActionResult Edit(UserFeed userfeed)
 {
     if (ModelState.IsValid)
     {
         db.UserFeeds.Attach(userfeed);
         db.ObjectStateManager.ChangeObjectState(userfeed, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.Filter_ID = new SelectList(db.Filters, "ID", "FilterText", userfeed.Filter_ID);
     ViewBag.User_ID = new SelectList(db.Users, "ID", "UserName", userfeed.User_ID);
     return View(userfeed);
 }
Exemple #4
0
 /// <summary>
 /// Create a new UserFeed object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="user_ID">Initial value of the User_ID property.</param>
 /// <param name="isPublic">Initial value of the IsPublic property.</param>
 /// <param name="isFavourite">Initial value of the IsFavourite property.</param>
 /// <param name="filter_ID">Initial value of the Filter_ID property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 public static UserFeed CreateUserFeed(global::System.Guid id, global::System.Guid user_ID, global::System.Boolean isPublic, global::System.Boolean isFavourite, global::System.Guid filter_ID, global::System.String title, global::System.String description)
 {
     UserFeed userFeed = new UserFeed();
     userFeed.ID = id;
     userFeed.User_ID = user_ID;
     userFeed.IsPublic = isPublic;
     userFeed.IsFavourite = isFavourite;
     userFeed.Filter_ID = filter_ID;
     userFeed.Title = title;
     userFeed.Description = description;
     return userFeed;
 }