public IActionResult SaveUpdate(Education education, string returnUrl) { if (education.IsNew) { education.UserId = User.GetId(); if (DbContext.Education.Create(education) > 0) { ShowSavedSuccessfullyToast(); } else { ShowTaskFailedToast(); }; } else { if (DbContext.Education.Update(education)) { ShowUpdateSuccessfullyToast(); } else { ShowTaskFailedToast(); }; } return Redirect(returnUrl); }
// GET: /<controller>/ public IActionResult GetFormForSaveAndUpdate(long id, string returnUrl) { ViewBag.ReturnUrl = returnUrl; var education = new Education(); if (id > 0) { education = DbContext.Education.Get(id); } return PartialView("_EducationForm", education); }