Ejemplo n.º 1
0
        public ActionResult AddTask(AddTaskViewModel taskModel)
        {
            var connectionFactory = new ConnectionFactory(ConnectionResource.ConnectionString);
            var context = new QulixContext(connectionFactory);

            using (var uow = context.CreateUnitOfWork())
            {
                var repositoryFactory = new RepositoryFactory(context);
                var taskService = new TaskService(uow, repositoryFactory);
                var task = taskService.CreateTask(taskModel.Name, taskModel.Workload, taskModel.StartDate,
                    taskModel.EndDate, taskModel.Status, taskModel.PerformerId);
                return RedirectToAction("ViewTasks", "Home");
            }
        }
Ejemplo n.º 2
0
        public ActionResult AddTask()
        {
            var connectionFactory = new ConnectionFactory(ConnectionResource.ConnectionString);
            var context = new QulixContext(connectionFactory);

            using (var uow = context.CreateUnitOfWork())
            {
                var repositoryFactory = new RepositoryFactory(context);
                var performerService = new PerformerService(uow, repositoryFactory);
                var performers = performerService.GetAllPerformers();
                if (performers == null)
                {
                    performers=new List<Performer>();
                }
                var addTaskViewModel = new AddTaskViewModel()
                {
                    PerformerModels = performers
                };
                return View(addTaskViewModel);
            }
        }