public IActionResult Create(Experience experience, People person)
        {
            db.Experiences.Add(experience);
            var newPeopleExperience = new PeopleExperience {
                PersonId = person.PersonId, ExperienceId = experience.ExperienceId
            };

            db.PeopleExperiences.Add(newPeopleExperience);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public IActionResult Create(Experience experience)
        {
            db.Experiences.Add(experience);
            var persons = Request.Form["PersonId"];

            for (int i = 0; i < persons.Count; i++)
            {
                PersonExperience pe = new PersonExperience();
                pe.PersonId     = int.Parse(persons[i]);
                pe.ExperienceId = experience.ExperienceId;
                db.PersonExperiences.Add(pe);
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public IActionResult Create(Post post)
        {
            var TagString = this.Request.Form["TagString"];

            db.Posts.Add(post);
            var OldTags = db.Tags.ToList();

            db.SaveChanges();
            List <Tag> NewTags = db.TagSaver(TagString);

            foreach (var oldTag in OldTags)
            {
                for (int i = 0; i < NewTags.Count; i++)
                {
                    if (NewTags[i].Name == oldTag.Name)
                    {
                        NewTags[i].TagId = oldTag.TagId;
                    }
                }
            }
            foreach (var tag in NewTags)
            {
                if (tag.TagId == 0)
                {
                    db.Tags.Add(tag);
                    db.SaveChanges();
                }
                var newPostTag = new PostTags()
                {
                    TagId = tag.TagId, PostId = post.PostId
                };
                db.PostTags.Add(newPostTag);
                db.SaveChanges();
            }
            return(RedirectToAction("Index/" + post.LocationId));
        }
Ejemplo n.º 4
0
 public IActionResult Create(Location location)
 {
     db.Locations.Add(location);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public IActionResult Create(Experience experience)
 {
     db.Experiences.Add(experience);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 6
0
 public IActionResult Create(Person person)
 {
     db.People.Add(person);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 7
0
 public ActionResult Create(People people)
 {
     db.Peoples.Add(people);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }