Ejemplo n.º 1
0
        public ActionResult Create(Post post)
        {
            var statuses = new List<ViewDataUploadFileResult>();
            statuses = (List<ViewDataUploadFileResult>)TempData["statuses"];

            if (ModelState.IsValid)
            {
                post.User = db.UserProfiles.Single(u => u.UserName == User.Identity.Name);

                db.SaveChanges();

                foreach (var status in statuses)
                {
                    Track track = db.Tracks.ToList().Find(x => x.FileName == status.url);
                    post.Tracks.Add(track);
                    //TracksInPost tracks = new TracksInPost();
                }
                db.Posts.Add(post);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(post);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Post post)
 {
     return RedirectToAction("Index");
 }