public async Task <IActionResult> GetView([FromBody] filterStock objFilter) { try { //filterStock objFilter = new filterStock(); //objFilter.product_id = id; return(Ok(await _objModule.executGetStockTrans(objFilter))); } catch (Exception e) { return(BadRequest(e.Message.ConvertExceptionToErrorInfo())); } }
public async Task <IQueryable <vwProductStockModel> > executGetStockTrans(filterStock objFilter) { try { string sql = string.Format("exec stk_trn_search {0} , '{1}' , {2} , {3}" , objFilter.product_id == null ? "null" : objFilter.product_id.ToString() , objFilter.product_name , objFilter.stock_trn_id == null ? "null" : objFilter.stock_trn_id.ToString() , objFilter.trans_date == null ? "null" : string.Format("'{0:yyyy-MM-dd}'", objFilter.trans_date) ); return(UnitOfWork.Context.Query <vwProductStockModel>().FromSql(sql)); } catch (Exception ex) { throw new Exception(ex.Message); } finally { } }