public IHttpActionResult AssignTask(TaskManagementViewModel model) { //get user var collector = _context.Users .Where(x => x.Roles.Select(y => y.RoleId).Contains("99")) .SingleOrDefault(c => c.Id == model.CollectorId); var taskInDB = _context.HomeVisits .Where(x => model.listTaskId.Any(y => y == x.Id)) .ToList(); //if user not found if (collector == null) { return(BadRequest()); } //update customer in db for (int i = 0; i < taskInDB.Count; i++) { taskInDB[i].ApplicationUserId = collector.Id; } _context.SaveChanges(); return(Ok()); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { var viewModel = new TaskManagementViewModel(); DataContext = viewModel; Run.Sequence(viewModel.Activate()); }
public ActionResult TaskManagement() { var userInDB = _context.Users .Where(x => x.Roles.Select(y => y.RoleId).Contains("99") && x.IsActive == true) .ToList(); var viewModel = new TaskManagementViewModel() { SelectList = new SelectList((userInDB), "Id", "Name", null) }; return(View(viewModel)); }
private void FormTaskManagement_Load(object sender, EventArgs e) { if (DesignMode) { return; } m_viewModel = new TaskManagementViewModel(); m_viewModel.UpdateTaskProgress += new Action <uint, IVX.DataModel.E_VDA_TASK_STATUS, uint>(m_viewModel_UpdateTaskProgress); m_viewModel.UpLoadLocalFile += new Action <uint, string, string, uint, ulong>(m_viewModel_UpLoadLocalFile); m_viewModel.TaskDeleted += new Action <DataModel.TaskInfoV3_1>(m_viewModel_TaskDeleted); m_viewModel.TaskAdded += new Action <DataModel.TaskInfoV3_1>(m_viewModel_TaskAdded); axfileupload1.SetMaxAbility((int)Framework.Environment.UploadAbility); BuildTaskList(); m_isInited = true; new System.Threading.Thread(thGetTaskProgress).Start(); }
public void SetUp() { mock = MockRepository.GenerateMock<ITaskService>(); model = new TaskManagementViewModel(mock); }