예제 #1
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);
            }
        }
예제 #2
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);
            }
        }