Beispiel #1
0
        public async Task <bool> updateAd(AdsModel a)
        {
            var v = await context.ads.Where(w => w.adid == a.adid && w.catid == a.catid && w.lid == a.lid).Select(x => x).FirstOrDefaultAsync();

            v.title       = a.title;
            v.description = a.descr;
            v.amount      = a.amount;
            v.phone       = a.phone;
            v.address     = a.address;
            context.SaveChanges();
            return(true);
        }
Beispiel #2
0
        public async Task <AdsModel> updateAd0(string adid, string catid, string lid)
        {
            int i  = Convert.ToInt32(lid);
            int a0 = Convert.ToInt32(adid);
            int c  = Convert.ToInt32(catid);
            var v  = await context.ads.Where(w => w.adid == a0 && w.catid == c && w.lid == i).Select(x => x).FirstOrDefaultAsync();

            AdsModel a = new AdsModel();

            a.amount  = v.amount;
            a.address = v.address;
            a.adid    = v.adid;
            a.catid   = v.catid;
            a.lid     = v.lid;
            a.phone   = v.phone;
            a.title   = v.title;
            a.descr   = v.description;
            return(a);
        }