示例#1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Project).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_context.Project.Any(e => e.ID == Project.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
示例#2
0
        //public SelectList PStatus;
        //public string ProjectStatus { get; set; }

        //public async Task OnGetAsync(string projectStatus)
        //{
        //    IQueryable<string> projectQuery = from p in _context.Project
        //                                      orderby p.Status
        //                                      select p.Status;

        //    var projects = from p in _context.Project
        //                   select p;

        //    PStatus = new SelectList(await projectQuery.Distinct().ToListAsync());
        //}

        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Project.Add(Project);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
示例#3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Project = await _context.Project.FindAsync(id);

            if (Project != null)
            {
                _context.Project.Remove(Project);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }