Exemplo n.º 1
0
        public IActionResult Edit(Person person)
        {
            if (person.Id != null)
            {
                var found = _context.Person.Find(person.Id);
                if (ModelState.IsValid)
                {
                    found.Name    = person.Name;
                    found.Dob     = person.Dob;
                    found.Gender  = person.Gender;
                    found.Country = person.Country;
                    found.State   = person.State;
                    _context.Entry(found).State = EntityState.Modified;
                    _context.Update(found);
                    _context.SaveChanges();
                }
            }
            //var found = _context.Person.Find(person.Id);
            //if (ModelState.IsValid && found != null)
            //{

            //    _context.Entry(found).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            //    _context.Update(found);
            //    _context.SaveChanges();
            //}
            return(RedirectToAction("Edit"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "id,professionalHeadline,completion,showPhone,created,verified,flags,weight,locale,subjectId,picture,hasEmail,isTest,name,location,theme,pictureThumbnail,claimant,summaryOfBio,weightGraph,publicId")] Person person)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "CandidateId")] Candidate candidate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(candidate).State = EntityState.Modified;
         db.SaveChangesAsync();
         return(RedirectToAction("Index"));
     }
     return(View(candidate));
 }