Exemplo n.º 1
0
        public WishEntity GetWishByID(int id)
        {
            var wish = db.Wishes.FirstOrDefault(m => m.ID == id);

            wish.Count += 1;
            db.SaveChanges();
            var wishEntity = new WishEntity()
            {
                ApplyUserID     = wish.ApplyUserID,
                Count           = wish.Count,
                DateStart       = wish.DateStart,
                Description     = wish.Description,
                Hope            = wish.Hope,
                ID              = wish.ID,
                Name            = wish.Name,
                PictureFile     = wish.PictureFile,
                Status          = wish.Status,
                Support         = wish.Support,
                Title           = wish.Title,
                UserID          = wish.UserID,
                WishDescription = wish.WishDescription
            };

            wishEntity.User = db.Users.FirstOrDefault(m => m.ID == wish.UserID);

            return(wishEntity);
        }
Exemplo n.º 2
0
        public WishEntity getTestWish()
        {
            TwnContext context = new TwnContext();

            var user = context.Users.Add(new UserEntity()
            {
                Email       = "[email protected]",
                FName       = "TestNameUser",
                Username    = "******",
                PhoneNumber = "0944587369",
                LName       = "larry",
                PenisSize   = 123123f
            });

            double price = new Random().Next(0, 200);
            var    wish  = new WishEntity()
            {
                MaxPrice  = price,
                ExtraPay  = 7,
                GrantedOn = DateTime.Today,
                User      = user,
                Name      = "noose"
            };

            var wishEntity = context.Wishes.Add(wish);

            context.Users.Add(user);
            using (context)
            {
                context.SaveChanges();
            }
            return(wishEntity);
        }