示例#1
0
        public async Task <IActionResult> Assing(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var agenda = await _dataContext.Agendas
                         .FirstOrDefaultAsync(o => o.Id == id.Value);

            if (agenda == null)
            {
                return(NotFound());
            }

            var employee = await _dataContext.Employees.FirstOrDefaultAsync(o => o.User.UserName.ToLower().Equals(User.Identity.Name.ToLower()));

            if (employee == null)
            {
                return(NotFound());
            }

            var model = new AgendaViewModel
            {
                Id         = agenda.Id,
                EmployeeId = employee.Id,
                Labours    = _combosHelper.GetComboLabours(employee.Id)
            };

            return(View(model));
        }
示例#2
0
        public async Task <IActionResult> Assing(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var agenda = await _dataContext.Agendas
                         .FirstOrDefaultAsync(o => o.Id == id.Value);

            if (agenda == null)
            {
                return(NotFound());
            }

            var model = new AgendaViewModel
            {
                Id        = agenda.Id,
                Employees = _combosHelper.GetComboEmployees(),
                Labours   = _combosHelper.GetComboLabours(0)
            };

            return(View(model));
        }