Exemplo n.º 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 (!ProjectExists(Project.ProjectID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("/Worker/Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync(int?id, int?projid)
        {
            if (id == null || projid == null)
            {
                return(NotFound());
            }

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

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

            Project.WorkerID = null;

            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                /*if (!ProjectExists(Project.ProjectID))
                 * {
                 *  return NotFound();
                 * }
                 * else
                 * {
                 *  throw;
                 * }*/
            }

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