Пример #1
0
        public async Task<ActionResult> Index()
        {
            ViewBag.Title = "Home Page";

            Context dbContext = new Context();

            //var Belarus = new Country();
            //Belarus.Name = "Беларусь";

            var Matem = new DTO.Task();
            Matem.Id = Guid.NewGuid();
            Matem.Description = "f";
            Matem.Files = new List<DTO.File>() { new DTO.File() { Id = Guid.NewGuid(), Name = "Kyrsa4" }, new DTO.File() { Id = Guid.NewGuid(), Name = "Prakti4eska9" } };
            

            dbContext.Tasks.Add(Matem);
            //dbContext.Lol.Add(new Models.LOL() { Name = "bob" });
            await dbContext.SaveChangesAsync();
            //dbContext.Countries.Add(Belarus);

             
            var lol = await dbContext.Tasks.FirstOrDefaultAsync(t => t.Description == "f");
            var ld = lol.Files;

            var vassal = dbContext.Files.Where(f => f.Task.Id == lol.Id);
            return View();
        }
Пример #2
0
 public static async Task<List<DTO.Learner>> GetAll(Guid id)
 {
     OnlineHelper.AddToList(id);
     try
     {
         using (Context dbContext = new Context())
         {
             return await dbContext.Learners.ToListAsync();
         }
     }
     catch (Exception)
     {
         return null;
     }
 }
Пример #3
0
        public async Task<Constants> Registration(DTO.Learner user)
        {
            try
            {
                using (Context dbContext = new Context())
                {
                    if (await dbContext.Learners.AnyAsync(l => l.MobilePhone == user.MobilePhone))
                    {
                        return Constants.UserAlreadyExist;
                    }
                    else
                    {
                        dbContext.Learners.Add(user);
                        await dbContext.SaveChangesAsync();
                        return Constants.Ok;
                    }
                }
            }
            catch (Exception)
            {
                return Constants.ServerError;
            }

        }