Пример #1
0
        public IActionResult SaveUpdate(Experience experience, string returnUrl)
        {
            if (experience.IsNew)
            {
                experience.UserId = User.GetId();
                if (DbContext.Experience.Create(experience) > 0)
                {
                    ShowSavedSuccessfullyToast();
                }
                else
                {
                    ShowTaskFailedToast();
                };


            }
            else
            {
                if (DbContext.Experience.Update(experience))
                {
                    ShowUpdateSuccessfullyToast();
                };
            }
            return Redirect(returnUrl);

        }
Пример #2
0
        public IActionResult GetFormForSaveAndUpdate(long id, string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            var exp = new Experience();
            if (id > 0)
            {
                exp = DbContext.Experience.Get(id);
            }

            return PartialView("_ExperienceForm", exp);
        }