public async void AllocateTechnician(string id, string techid) { Employ NewEmploy = new Employ(); NewEmploy.TechnicianID = techid; NewEmploy.ProjectID = id; _context.Employ.Add(NewEmploy); await _context.SaveChangesAsync(); }
public async Task <IActionResult> OnPostAsync(string id) { Requirement.ProjectID = id; _context.Requirement.Add(Requirement); await _context.SaveChangesAsync(); if (User.IsInRole(IdentityData.NonAdminRoleNames[0])) { return(RedirectToPage("../ClientLayout/MyProjects")); } return(RedirectToPage("./Index")); }
public async Task<IActionResult> OnPostAsync(string id) { if (id == null) { return NotFound(); } Requirement = await _context.Requirement.FindAsync(id); if (Requirement != null) { _context.Requirement.Remove(Requirement); await _context.SaveChangesAsync(); } return RedirectToPage("./Index"); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } ApplicationUser = await _context.Users.FindAsync(id); if (ApplicationUser != null) { _context.Users.Remove(ApplicationUser); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { string ProjectID = Request.Form["ProjectID"]; string userId = User.Identity.Name; // Gets the current logged email currentUser = _context.Technician.FirstOrDefault(x => x.Email == userId); // Gets from context the Client with that email Interest newInterest = new Interest(); newInterest.ProjectID = ProjectID; newInterest.TechnicianID = currentUser.TechnicianID; try{ _context.Interest.Add(newInterest); await _context.SaveChangesAsync(); } catch (Exception e) { Console.WriteLine("The user is already interested in this project: " + e); } return(RedirectToPage("./MyProjects")); }