public static string getArticleByStoreId(string idStoreCad) { string res = string.Empty; short storeId = 0; List <BEArticle> lista = null; GenerateResponse gen = new GenerateResponse(); if (short.TryParse(idStoreCad, out storeId)) { lista = dal.getArticleByStoreId(storeId); if (lista == null) { res = gen.ResponseError(404, "Record not Found"); } else { res = gen.ResponseSuccess <BEArticle>(lista); } } else { res = gen.ResponseError(400, "Bad Request"); } return(res); }
public static string getArticles() { GenerateResponse gen = new GenerateResponse(); List <BEArticle> lista = dal.getArticles(); string res = gen.ResponseSuccess(lista); return(res); }
public static string getStores() { DALStore dal = new DALStore(); string res = string.Empty; GenerateResponse gen = new GenerateResponse(); List <BEStore> lista = dal.getStores(); res = gen.ResponseSuccess <BEStore>(lista); return(res); }
public static string addArticle(BEArticle art) { string res = string.Empty; GenerateResponse gen = new GenerateResponse(); try { bool exito = dal.addArticle(art); res = gen.ResponseSuccess(); } catch (Exception ex) { res = gen.ResponseError(404, ex.Message); } return(res); }