예제 #1
0
 public CertificationsModel UpdateCertification(CertificationsModel newCertification, int CertificationId)
 {
     //var Certification = certData.GetById(CertificationId);
     //Certification.CertName = newCertification.CertName;
     //Certification.CertSubject = newCertification.CertSubject;
     //Certification.CertSite = newCertification.CertSite;
     //Certification.CertDescription = newCertification.CertDescription;
     //Certification.CertUrl = newCertification.CertUrl;
     TryUpdateModelAsync(newCertification);
     newCertification.Author = User.Identity.Name;
     certData.Update(newCertification);
     certData.Commit();
     TempData["Message"] = $"Certification '{Certification.CertName}' Updated!";
     return(Certification);
 }
 public IActionResult OnPost()
 {
     if (!ModelState.IsValid)
     {
         Groups = htmlHelper.GetEnumSelectList <GroupsType>();
         return(Page());
     }
     if (Certification.IdCertif > 0)
     {
         certificationData.Update(Certification);
     }
     else
     {
         certificationData.Add(Certification);
     }
     certificationData.Commit();
     TempData["Message"] = "Changes in editing saved";
     return(RedirectToPage("./Detail", new { certificationId = Certification.IdCertif }));
 }