コード例 #1
0
        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);

        }
コード例 #2
0
 // 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);
 }