Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectFinishedExists(ProjectFinished.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync(string ClientUserName, string TechnicianUserName)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            if (TechnicianUserName == null && ClientUserName == null)
            {
                return(NotFound());
            }
            else
            {
                var clients = from t in _context.Client
                              select t;
                clients        = clients.Where(s => s.UserName.Equals(ClientUserName));
                SelectedClient = await clients.ToListAsync();

                Client = SelectedClient[0];

                var technicians = from t in _context.Technician
                                  select t;
                technicians        = technicians.Where(s => s.UserName.Equals(TechnicianUserName));
                SelectedTechnician = await technicians.ToListAsync();

                Technician = SelectedTechnician[0];

                ProjectAssigned.Client     = Client;
                ProjectAssigned.Technician = Technician;
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectAssignedExists(ProjectAssigned.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

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