Esempio n. 1
0
 public List <CatalogDisplayModel> DisplayList(CatalogDisplayPlace place)
 {
     return(Db.CatalogShownPlace.Include(c => c.Catalog)
            .Where(c => c.ShownPlace == place)
            .Select(c => c.Catalog)
            .ProjectTo <CatalogDisplayModel>(_mapper.ConfigurationProvider)
            .ToList());
 }
Esempio n. 2
0
 public DbResponse <List <CatalogDisplayModel> > GetDisplayList(CatalogDisplayPlace place)
 {
     try
     {
         var data = _db.Catalog.DisplayList(place);
         return(new DbResponse <List <CatalogDisplayModel> >(true, "Success", data));
     }
     catch (Exception e)
     {
         return(new DbResponse <List <CatalogDisplayModel> >(false, e.Message));
     }
 }
Esempio n. 3
0
        public DbResponse DeletePlace(int catalogId, CatalogDisplayPlace shownPlace)
        {
            try
            {
                if (!_db.Catalog.IsPlaceAssign(catalogId, shownPlace))
                {
                    return(new DbResponse(false, "Data not found"));
                }

                _db.Catalog.PlaceDelete(catalogId, shownPlace);
                _db.SaveChanges();

                return(new DbResponse(true, "Success"));
            }
            catch (Exception e)
            {
                return(new DbResponse(false, e.Message));
            }
        }
        //Delete Placement
        public IActionResult DeletePlacement(int categoryId, CatalogDisplayPlace place)
        {
            var response = _catalog.DeletePlace(categoryId, place);

            return(Json(response));
        }
        //Get Placement
        public IActionResult GetPlacement(CatalogDisplayPlace place)
        {
            var response = _catalog.GetDisplayList(place);

            return(Json(response));
        }
Esempio n. 6
0
 public void PlaceDelete(int catalogId, CatalogDisplayPlace shownPlace)
 {
     Db.CatalogShownPlace.Remove(catalogShownPlace);
 }
Esempio n. 7
0
 public bool IsPlaceAssign(int catalogId, CatalogDisplayPlace shownPlace)
 {
     catalogShownPlace = Db.CatalogShownPlace.FirstOrDefault(c => c.CatalogId == catalogId && c.ShownPlace == shownPlace);
     return(catalogShownPlace != null);
 }
Esempio n. 8
0
        //get category
        public IActionResult GetCategory(CatalogDisplayPlace place, int numberOfData)
        {
            var response = _catalog.GetDisplayList(place, numberOfData);

            return(Json(response));
        }