public bool Update(int id, ProductModel entity, CurrentUserModel currentUser) { try { CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser); parameters.Add("@i_Id", id); parameters.Add("@i_Name", entity.Name); parameters.Add("@i_Description", entity.Description); parameters.Add("@i_Image", entity.Image); parameters.Add("@i_Price", entity.Price); parameters.Add("@i_Deposit", entity.Deposit); parameters.Add("@i_AvailableFromDate", entity.AvailableFromDate); parameters.Add("@i_AvailableToDate", entity.AvailableToDate); parameters.Add("@i_Location", entity.LocationId); parameters.Add("@i_Shipping", entity.Shipping); parameters.Add("@i_Address", entity.Address); ExecuteNoneQuery("Update_Product", parameters); return(true); } catch (Exception ex) { LogManager.LogError("Update Product: ", ex); throw ex; } }
public IEnumerable <ProductModel> Get(CurrentUserModel currentUser) { try { CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser); IEnumerable <ProductModel> result = ExecuteQuery <ProductModel>("Get_Product", parameters); return(result); } catch (Exception ex) { LogManager.LogError("Product get all", ex); throw; } }
public ProductModel Get(int id, CurrentUserModel currentUser) { try { CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser); parameters.Add("@i_Id", id); ProductModel result = ExecuteQuery <ProductModel>("Get_ProductById", parameters).FirstOrDefault(); return(result); } catch (Exception ex) { LogManager.LogError("Product get by id", ex); throw; } }
public bool Delete(int id, CurrentUserModel currentUser) { try { CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser); parameters.Add("@i_Id", id); ExecuteNoneQuery("Delete_Product", parameters); return(true); } catch (Exception ex) { LogManager.LogError("Product delete by id", ex); return(false); throw; } }
public bool Add(CategoryModel entity, CurrentUserModel currentUser) { try { CustomDynamicParameters parameters = new CustomDynamicParameters(currentUser); parameters.Add("@i_Name", entity.Name); parameters.Add("@i_Description", entity.Description); parameters.Add("@i_Image", entity.Image); parameters.Add("@i_Location", entity.LocationId); ExecuteNoneQuery("Add_Category", parameters); return(true); } catch (Exception ex) { LogManager.LogError("Add Category: ", ex); throw ex; } }