public IActionResult StartQueue(int id) { QueueRollModel QueueRoll = new QueueRollModel(); EmployeeModel Employee = new EmployeeModel(); QueueModel Queue = new QueueModel(); TaskModel Task = new TaskModel(); Queue = QueueQuery.GetQueue(id); Employee = EmployeeQuery.GetEmployee(Queue.EmployeeId); Task = TaskQuery.GetTask(Queue.TaskId); QueueRoll.QueueId = Queue.QueueId; QueueRoll.EmployeeId = Queue.EmployeeId; QueueRoll.TaskId = Queue.TaskId; QueueRoll.StartDate = DateTime.Now; Task.StartDate = QueueRoll.StartDate; QueueRoll.Rate = Employee.Rate; Task.Status = "Started"; Task = TaskQuery.UpdateTask(Task); QueueRoll = QueueRollQuery.CreateQueueRoll(QueueRoll); return(Redirect("~/Queue/Close")); }
public IActionResult Edit(int id) { //set view data to be displayed ViewData["Message"] = "Please edit the employee information."; //create new employee model to pass along EmployeeModel Employee = new EmployeeModel { EmployeeId = id, //set model ID Roles = RoleQuery.GetRoles() //Set Roles model list to employee model to make it available in the view }; Employee.Fullname = Employee.Name + " " + Employee.Lastname; //set full names in the model Employee = EmployeeQuery.GetEmployee(Employee); //get employee information from the database, we pass the model to the function ViewData["TaskID"] = "Task ID: " + Employee.EmployeeId; //set viewdata return(PartialView("_Edit", Employee)); //return edit view }