Esempio n. 1
0
        public ActionResult <Tasks> Create(Tasks book, string username, string userid, string projectid)
        {
            Thread.Sleep(1000);
            Tasks check = _tasksService.GetByGanttMadeId(book.id);

            Console.WriteLine("From Gant Controller" + book.id);
            Console.WriteLine("check{0}", check);
            if (check == null)
            {
                Console.WriteLine("insid null");
                _tasksService.Create(book);
                // Console.WriteLine("Username is",username);

                Tasks obj = new Tasks()
                {
                    TaskId     = book.TaskId,
                    id         = book.id,
                    project_id = book.project_id,
                    action     = "post",
                    start_date = book.start_date,
                    end_date   = book.end_date,
                    duration   = book.duration,
                    progress   = book.progress,
                    text       = book.text,

                    unique_id = book.unique_id
                };
                RabbitMQProducer producer2 = new RabbitMQProducer();
                producer2.SendUserStoryToBoards(obj);
                Console.WriteLine("created here");
                // AddUS logger =new AddUS(){
                //     type="Gantt@AddUserStory",
                //     id ="userid",
                //     description=username+" added"+ book.text +"UserStory to gantt chart",
                //     published=DateTime.Now,
                //     data=new Data(){
                //         id=book.id,
                //         name=book.text
                //     }
                // };
                //  RabbitMQProducer producer=new RabbitMQProducer();
                // producer.AddUserStory(logger);

                Logger logger1 = new Logger()
                {
                    type        = "Activity@AddUserStory",
                    id          = userid,
                    project_id  = projectid,
                    description = username + " added " + book.text + " to gantt chart",
                    published   = DateTime.Now,
                    data        = new Data()
                    {
                        id   = book.id,
                        name = book.text
                    }
                };
                // Console.WriteLine(JsonConvert.SerializeObject(logger1));
                // Console.WriteLine(logger1);
                _loggerService.Create(logger1);
                //  RabbitMQProducer producer1=new RabbitMQProducer();
                // producer1.AddUserStoryAct(logger1);

                return(CreatedAtRoute("GetTasks", new { id = book.TaskId.ToString() }, book));
            }
            return(Ok());
        }