Beispiel #1
0
        public List <AdoramaListings> MakeAdoramaListingActive(IdList adoramaListingIds)
        {
            if (!HelperMethods.NullCheckForIdListIds(adoramaListingIds))
            {
                return(null);
            }

            int[] adoramaIds = adoramaListingIds.ids.Split(',').Select(n => Convert.ToInt32(n)).ToArray();
            List <AdoramaListings> adoramaListings = new List <AdoramaListings>();

            try
            {
                foreach (int adoramaId in adoramaIds)
                {
                    AdoramaListings adoramaListing = db.AdoramaListings.Where(x => x.idadoramalistings == adoramaId).FirstOrDefault();
                    if (adoramaListing == null)
                    {
                        return(null);
                    }
                    adoramaListing.active = 1;
                    db.AdoramaListings.Update(adoramaListing);
                    db.SaveChanges();
                    adoramaListings.Add(adoramaListing);
                }
                return(adoramaListings);
            }
            catch (Exception ex)
            {
                // FIXME log error
                return(null);
            }
        }
Beispiel #2
0
        public bool DeleteKlipschListing(IdList klipschIds)
        {
            if (!HelperMethods.NullCheckForIdListIds(klipschIds))
            {
                return(false);
            }

            try
            {
                int[] klipschListingIds = klipschIds.ids.Split(',').Select(n => Convert.ToInt32(n)).ToArray();
                foreach (int klipschId in klipschListingIds)
                {
                    AdoramaListings klipschListing = db.AdoramaListings.Where(x => x.idadoramalistings == klipschId).FirstOrDefault();
                    if (klipschListing == null)
                    {
                        return(false);
                    }
                    db.Remove(klipschListing);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                // FIXME log error
                return(false);
            }
            return(true);
        }
Beispiel #3
0
 public AdoramaListings AddMiscListing(AdoramaListings miscListing)
 {
     if (miscListing != null)
     {
         db.AdoramaListings.Add(miscListing);
         db.SaveChanges();
         return(miscListing);
     }
     return(null);
 }
Beispiel #4
0
 public AdoramaListings AddKlipschListing(AdoramaListings adoramaListing)
 {
     if (adoramaListing != null)
     {
         db.AdoramaListings.Add(adoramaListing);
         db.SaveChanges();
         return(adoramaListing);
     }
     return(null);
 }
Beispiel #5
0
 public ActionResult <AdoramaListings> AddMiscListing([FromBody] AdoramaListings miscListing)
 {
     return(ebayDBRecords.AddMiscListing(miscListing));
 }
Beispiel #6
0
 public ActionResult <AdoramaListings> AddKlipschListing([FromBody] AdoramaListings adoramaListing)
 {
     return(ebayDBRecords.AddKlipschListing(adoramaListing));
 }