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()); }
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)); } }
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)); }
public void PlaceDelete(int catalogId, CatalogDisplayPlace shownPlace) { Db.CatalogShownPlace.Remove(catalogShownPlace); }
public bool IsPlaceAssign(int catalogId, CatalogDisplayPlace shownPlace) { catalogShownPlace = Db.CatalogShownPlace.FirstOrDefault(c => c.CatalogId == catalogId && c.ShownPlace == shownPlace); return(catalogShownPlace != null); }
//get category public IActionResult GetCategory(CatalogDisplayPlace place, int numberOfData) { var response = _catalog.GetDisplayList(place, numberOfData); return(Json(response)); }