Ejemplo n.º 1
0
        public async Task <T> UpdateAsync(T entity)
        {
            _dbContext.Entry(entity).State = EntityState.Modified;
            await _dbContext.SaveChangesAsync();

            return(entity);
        }
        public IActionResult Create(Experience experience)
        {
            db.Experiences.Add(experience);

            var thisPersonId = Int32.Parse(Request.Form["PersonId"]);
            var thisPerson   = db.People.FirstOrDefault(People => People.PersonId == thisPersonId);

            thisPerson.ExperienceId = experience.ExperienceId;
            var thisExperiencePeople = new ExperiencePeople {
            };

            thisExperiencePeople.ExperienceId = experience.ExperienceId;
            thisExperiencePeople.PersonId     = thisPerson.PersonId;
            db.ExperiencePeople.Add(thisExperiencePeople);

            db.Entry(thisPerson).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
 public IActionResult Edit(Person person)
 {
     db.Entry(person).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 4
0
 public IActionResult Edit(Experience experience)
 {
     db.Entry(experience).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public virtual void Update(T entity)
 {
     dbSet.Attach(entity);
     dbContext.Entry(entity).State = EntityState.Modified;
 }