예제 #1
0
        public IActionResult OnPost(int jobId)
        {
            var job = jobData.Delete(jobId);

            jobData.Commit();

            if (job == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            TempData["Message"] = $"{job.Name} deleted";
            return(RedirectToPage("./List"));
        }
예제 #2
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                Departments = htmlHelper.GetEnumSelectList <DepartmentType>();
                return(Page());
            }

            if (Job.Id > 0)
            {
                jobData.Update(Job);
            }
            else
            {
                jobData.Add(Job);
            }


            jobData.Commit();
            TempData["Message"] = "Restaurant saved!";
            return(RedirectToPage("./Detail", new { jobId = Job.Id }));
        }