public ActionResult create(AuctionViewModel model)
        {
            tbl_Auction auction = new tbl_Auction();

            auction.Title = model.Title;

            auction.Description = model.Description;

            auction.ActualAmount = model.ActualAmount;

            auction.StartingTime = model.StartingTime;

            auction.EndingTime = model.EndingTime;


            var pictureIDs = model.tbl_AuctionPicture.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();

            auction.tbl_AuctionPicture = new List <tbl_AuctionPicture>();

            foreach (var picID in pictureIDs)
            {
                var auctionPicture = new tbl_AuctionPicture();

                auctionPicture.PicID = picID;


                auction.tbl_AuctionPicture.Add(auctionPicture);
            }



            service.SaveAuction(auction);

            return(RedirectToAction("Index"));
        }
        public void SaveAuction(tbl_Auction auction)
        {
            OLXDBContext context = new OLXDBContext();

            context.tbl_Auction.Add(auction);

            context.SaveChanges();
        }
        public void DeleteAuction(tbl_Auction auction)
        {
            OLXDBContext context = new OLXDBContext();

            context.Entry(auction).State = System.Data.Entity.EntityState.Deleted;

            context.SaveChanges();
        }
        public void SaveEdit(tbl_Auction auction)
        {
            OLXDBContext context = new OLXDBContext();

            context.Entry(auction).State = System.Data.Entity.EntityState.Modified;

            context.SaveChanges();
        }
示例#5
0
        public void CreateAdd(tbl_Auction auction)
        {
            DealDoubleDBContext context = new DealDoubleDBContext();

            context.tbl_Auction.Add(auction);

            context.SaveChanges();
        }//Create ka post wala h
示例#6
0
        public void SaveAuction(tbl_Auction auction)
        {
            DealDoubeDashContext context = new DealDoubeDashContext();

            context.Auctions.Add(auction);

            context.SaveChanges();
        }
示例#7
0
        }//Edit ka post wala h

        public void DeleteAuction(tbl_Auction auction)
        {
            DealDoubleDBContext context = new DealDoubleDBContext();

            context.Entry(auction).State = System.Data.Entity.EntityState.Deleted;

            context.SaveChanges();
        }//Delete ka post wala h
示例#8
0
        }//Edit ka Get wala h

        public void UpdateEditByID(tbl_Auction auction)
        {
            DealDoubleDBContext context = new DealDoubleDBContext();

            context.Entry(auction).State = System.Data.Entity.EntityState.Modified;

            context.SaveChanges();
        }//Edit ka post wala h
        public ActionResult Edit(tbl_Auction auction)
        {
            AuctionsServices services = new AuctionsServices();

            services.UpdateEditByID(auction);

            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(tbl_Auction auction)
        {
            AuctionsServices services = new AuctionsServices();

            services.DeleteAuction(auction);

            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(tbl_Auction auction)
        {
            service.DeleteAuction(auction);

            return(View(auction));
        }
        public ActionResult Edit(tbl_Auction auction)
        {
            service.SaveEdit(auction);

            return(RedirectToAction("Index"));
        }
        public ActionResult create(tbl_Auction auction)
        {
            services.SaveAuction(auction);

            return(RedirectToAction("Index"));
        }