Esempio n. 1
0
        public ActionResult Create(Post posts)
        {
            if (ModelState.IsValid)
            {
                db.Posts.AddObject(posts);
                posts.date_creation = DateTime.Today;
                posts.date_last_view = DateTime.Today;
                //posts.users_id = "6d3952a6-27db-4996-85cf-6828988dbc30";
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.users_id = new SelectList(db.aspnet_Users, "UserId", "UserName", posts.users_id);
            ViewBag.companies_id = new SelectList(db.Companies, "id", "name", posts.companies_id);
            return View(posts);
        }
Esempio n. 2
0
 public ActionResult Edit(Post posts)
 {
     if (ModelState.IsValid)
     {
         db.Posts.Attach(posts);
         db.ObjectStateManager.ChangeObjectState(posts, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.users_id = new SelectList(db.aspnet_Users, "UserId", "UserName", posts.users_id);
     ViewBag.companies_id = new SelectList(db.Companies, "id", "name", posts.companies_id);
     return View(posts);
 }
Esempio n. 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Posts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPosts(Post post)
 {
     base.AddObject("Posts", post);
 }
Esempio n. 4
0
 /// <summary>
 /// Create a new Post object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="companies_id">Initial value of the companies_id property.</param>
 /// <param name="users_id">Initial value of the users_id property.</param>
 /// <param name="descryption">Initial value of the descryption property.</param>
 /// <param name="title">Initial value of the title property.</param>
 /// <param name="date_creation">Initial value of the date_creation property.</param>
 /// <param name="date_last_view">Initial value of the date_last_view property.</param>
 /// <param name="boss_rating">Initial value of the boss_rating property.</param>
 /// <param name="atmosphere_rating">Initial value of the atmosphere_rating property.</param>
 /// <param name="social_rating">Initial value of the social_rating property.</param>
 /// <param name="salary_rating">Initial value of the salary_rating property.</param>
 public static Post CreatePost(global::System.Int32 id, global::System.Int32 companies_id, global::System.Guid users_id, global::System.String descryption, global::System.String title, global::System.DateTime date_creation, global::System.DateTime date_last_view, global::System.Double boss_rating, global::System.Double atmosphere_rating, global::System.Double social_rating, global::System.Double salary_rating)
 {
     Post post = new Post();
     post.id = id;
     post.companies_id = companies_id;
     post.users_id = users_id;
     post.descryption = descryption;
     post.title = title;
     post.date_creation = date_creation;
     post.date_last_view = date_last_view;
     post.boss_rating = boss_rating;
     post.atmosphere_rating = atmosphere_rating;
     post.social_rating = social_rating;
     post.salary_rating = salary_rating;
     return post;
 }