Beispiel #1
0
        public async Task <ActionResult> Create([Bind(Include = "id_Timesheet,id_Customer,id_Contractor,id_Employee,id_WorkAssignment,StartTime,StopTime,Comments,CreatedAt,WorkComplete,LastModifiedAt,DeletedAt,Active,Latitude,Longitude")] Timesheet timesheet)
        {
            if (ModelState.IsValid)
            {
                db.Timesheets.Add(timesheet);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.id_Contractor     = new SelectList(db.Contractors, "id_Contractor", "CompanyName", timesheet.id_Contractor);
            ViewBag.id_Customer       = new SelectList(db.Customers, "id_Customer", "CustomerName", timesheet.id_Customer);
            ViewBag.id_Employee       = new SelectList(db.Employees, "id_Employee", "FirstName", timesheet.id_Employee);
            ViewBag.id_WorkAssignment = new SelectList(db.WorkAssignments, "id_WorkAssignment", "Title", timesheet.id_WorkAssignment);
            return(View(timesheet));
        }