Exemplo n.º 1
0
        public ActionResult AddPerformer(PerformerModel performerModel)
        {
            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 performer = performerService.CreatePerformer(performerModel.FirstName, performerModel.LastName, performerModel.PatronymicName);
                return RedirectToAction("ViewPerformers", "Home");
            }
        }
Exemplo 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);
            }
        }
Exemplo n.º 3
0
        public ActionResult DeletePerformers(int idValue)
        {
            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);
                performerService.RemovePerformer(idValue);
                uow.SaveChanges();
                return RedirectToAction("ViewPerformers", "Home");
            }
        }
Exemplo n.º 4
0
        //просмотр всех задач
        public ActionResult ViewTasks()
        {
            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 tasks = taskService.GetAllTasks();

                var model = new TaskListViewModel()
                {
                    Tasks = new List<TaskModel>()
                };

                var performerService = new PerformerService(uow, repositoryFactory);

                foreach (var task in tasks)
                {
                    var performer = performerService.GetPerformerById(task.PerformerId);
                    model.Tasks.Add(new TaskModel()
                    {
                        Id = task.Id,
                        Name = task.Name,
                        Workload = task.Workload,
                        StartDate = task.StartDate,
                        EndDate = task.EndDate,
                        Status = task.Status,
                        PerformerId = task.PerformerId,
                        Performer = performer
                    });
                }

                return View(model);
            }
        }
Exemplo n.º 5
0
        //просмотр всех исполнителей
        public ActionResult ViewPerformers()
        {
            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();

                var model = new PerformerListViewModel()
                {
                    Performers = new List<PerformerModel>()
                };

                if (performers == null)
                {
                    return View(model);
                }

                foreach (var performer in performers)
                {
                    model.Performers.Add(new PerformerModel()
                    {
                        Id = performer.Id,
                        FirstName = performer.FirstName,
                        LastName = performer.LastName,
                        PatronymicName = performer.PatronymicName
                    });
                }

                return View(model);
            }
        }