public HttpResponseMessage searchProcessTagNoList(ProcessTagSearchView model) { try { var result = tagSvc.searchProcessTagNoList(model); return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString())); } }
public CommonSearchView <ProcessTagView> searchProcessTagNoList(ProcessTagSearchView model) { using (var ctx = new ConXContext()) { var ventity = model.entity; var vreq_date = model.req_date; var vmc_code = model.mc_code; CommonSearchView <ProcessTagView> view = new ModelViews.CommonSearchView <ModelViews.ProcessTagView>() { datas = new List <ModelViews.ProcessTagView>() }; string sql = "select distinct process_tag_no"; sql += " from mps_det_in_process_tag"; sql += " where entity = :p_entity"; sql += " and req_date = to_date(:p_req_date,'dd/mm/yyyy')"; sql += " and mc_code = :p_mc_code"; List <ProcessTagView> tag_no = ctx.Database.SqlQuery <ProcessTagView>(sql, new OracleParameter("p_entity", ventity), new OracleParameter("p_req_date", vreq_date), new OracleParameter("p_mc_code", vmc_code)).ToList(); foreach (var i in tag_no) { view.datas.Add(new ModelViews.ProcessTagView() { process_tag_no = i.process_tag_no, }); } //return data to contoller return(view); } }