public async Task <IActionResult> Create([Bind("ID,BidID,EstStart,EstEnd,Amount,Location,ProjectID")] Bid bid) { if (ModelState.IsValid) { _context.Add(bid); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Desc", bid.ProjectID); return(View(bid)); }
public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Email,PhoneNumber,DepartmentID")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DepartmentID"] = new SelectList(_context.Departments, "ID", "Description", employee.DepartmentID); return(View(employee)); }
public async Task <IActionResult> Create([Bind("ID,Stage,Hours,Task,Submitter,SubmissionDate,ProjectID")] DesignDay designDay) { if (ModelState.IsValid) { _context.Add(designDay); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Desc", designDay.ProjectID); return(View(designDay)); }
public async Task <IActionResult> Create([Bind("ID,Submitter,SubmissionDate,ProjectID")] ProductionWorkReport productionWorkReport) { if (ModelState.IsValid) { _context.Add(productionWorkReport); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Desc", productionWorkReport.ProjectID); return(View(productionWorkReport)); }
public async Task <IActionResult> Create([Bind("ID,EstimatedBid,ActualDesingHours,EstimatedDesingHours,ActualDesingCost,EstimatedDesingCost,Hours,Remaining,ProjectID")] BidStageReport bidStageReport) { if (ModelState.IsValid) { _context.Add(bidStageReport); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Name", bidStageReport.ProjectID); return(View(bidStageReport)); }
public async Task <IActionResult> Add([Bind("ID,EstStartDate,EstHours,TeamID,TaskID")] Labour labour) { if (ModelState.IsValid) { _context.Add(labour); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } //PopulateDDl(labour); return(View(labour)); }
public async Task <IActionResult> Create([Bind("ID,Name,Desc,EstCost,BidDate,EstStartDate,EstFinishDate,CurrentPhase,StartDate,FinishDate,Cost,BidCustApproved,BidManagementApproved,ClientID,DesignerID")] Project project) { if (ModelState.IsValid) { _context.Add(project); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClientID"] = new SelectList(_context.Clients, "ID", "ConFirst", project.ClientID); ViewData["DesignerID"] = new SelectList(_context.Employees, "ID", "FirstName", project.DesignerID); return(View(project)); }
public async Task <IActionResult> Create([Bind("ProjectID,InventoryID,MatDelivery,MatInstall,MatEstQty,MatActQty")] ProjectMaterials projectMaterials) { if (ModelState.IsValid) { _context.Add(projectMaterials); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["InventoryID"] = new SelectList(_context.Inventories, "ID", "ID", projectMaterials.InventoryID); ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Desc", projectMaterials.ProjectID); return(View(projectMaterials)); }
public async Task <IActionResult> Create([Bind("ID,Quantity,Costs,Date,EmployeeID,ProjectID,MaterialID")] MaterialReport materialReport) { if (ModelState.IsValid) { _context.Add(materialReport); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeID"] = new SelectList(_context.Employees, "ID", "FullName", materialReport.EmployeeID); ViewData["MaterialID"] = new SelectList(_context.Materials, "ID", "Description", materialReport.MaterialID); ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Name", materialReport.ProjectID); return(View(materialReport)); }
public async Task <IActionResult> Create([Bind("ID,Hours,Costs,Date,EmployeeID,ProjectID,TaskID")] WorkerReport workerReport) { if (ModelState.IsValid) { _context.Add(workerReport); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeID"] = new SelectList(_context.Employees, "ID", "FullName", workerReport.EmployeeID); ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Name", workerReport.ProjectID); ViewData["TaskID"] = new SelectList(_context.Tasks, "ID", "Description", workerReport.TaskID); return(View(workerReport)); }
public async Task <IActionResult> Add([Bind("ID,ProjectID,EmployeeID")] ProjectEmployee projectEmployee) { try { if (ModelState.IsValid) { _context.Add(projectEmployee); await _context.SaveChangesAsync(); return(RedirectToAction("Index", new { projectEmployee.ProjectID })); } } catch (DbUpdateException) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } PopulateDropdownLists(projectEmployee.ProjectID); return(View(projectEmployee)); }
public async Task <IActionResult> Create([Bind("ID,Name,ProjSite,ProjBidDate,EstStartDate,EstEndDate,StartDate,EndDate,ActAmount,EstAmount,ClientApproval,AdminApproval,ProjCurrentPhase,ClientID,ProjIsFlagged")] Project project, string [] selectedLabors, string[] selectedMaterials) { try { UpdateProjectLabours(selectedLabors, project); UpdateProjectMaterials(selectedMaterials, project); if (ModelState.IsValid) { _context.Add(project); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch (RetryLimitExceededException /* dex */) { ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator."); } PopulateAssignedLaborData(project); PopulateAssignedMaterialData(project); ViewData["ClientID"] = new SelectList(_context.Clients, "ID", "FullName", project.ClientID); return(View(project)); }