Пример #1
0
        public static List <string> AuthorNameAndImagePath(int idPost)
        {
            TokenDatabaseContext context   = new TokenDatabaseContext();
            Task <string>        autorPost = (from author in context.AspNetUsers
                                              join post in context.UsersImages on author.Id equals post.IdUser
                                              where post.Id == idPost
                                              select author.UserName).FirstOrDefaultAsync();
            Task <string> authorId = (from author in context.AspNetUsers
                                      join post in context.UsersImages on author.Id equals post.IdUser
                                      where post.Id == idPost
                                      select author.Id).FirstOrDefaultAsync();
            Task <string> imagePath = (from path in context.Images
                                       join post in context.UsersImages on path.Id equals post.IdImage
                                       where post.Id == idPost
                                       select path.Path).FirstOrDefaultAsync();
            List <string> list = new List <string>();

            list.Add(autorPost.Result);
            list.Add(imagePath.Result);
            list.Add(authorId.ToString());
            return(list);
        }
Пример #2
0
        public override string ToString()
        {
            StringWriter SW = new StringWriter();

            SW.WriteLine("Schedule ID: " + this.ID);
            SW.WriteLine("Customer: " + this.Customer.ToString());
            SW.WriteLine("Start Date: " + this.StartDate.ToString("dd/mm/yyy hh:mm"));
            SW.WriteLine("Finish Date: " + this.FinishDate.ToString("dd/mm/yyy hh:mm"));

            SW.WriteLine("Tasks:");
            foreach (Task Task in this.Tasks)
            {
                SW.WriteLine(" - " + Task.ToString());
            }

            SW.WriteLine("Employees:");
            foreach (Employee Emp in this.Employees)
            {
                SW.WriteLine(" - " + Emp.Firstname + " " + Emp.Lastname);
            }

            return(SW.ToString());
        }