public HttpResponseMessage getStocksOnPersonel(DTOGetPersonelStock request) { // Personellerin Üzerlerindeki serileri görebilmeleri için oluşturuldu (Stok-seri kontrolü) ArrayList list = new ArrayList(); var user = KOCAuthorizeAttribute.getCurrentUser(); var personel = request.personelid != null ? request.personelid.Value : user.userId; using (var db = new KOCSAMADLSEntities()) { var type = db.stockcard.ToList(); for (int i = 0; i < type.Count; i++) { var serials = db.getSerialsOnPersonelAdsl(personel, type[i].stockid).ToList(); for (int j = 0; j < serials.Count; j++) { DTOStockReturn res = new DTOStockReturn(); res.stockid = type[i].stockid; res.stockname = type[i].productname; res.personelid = personel; res.serials = serials[j]; list.Add(res); } } return(Request.CreateResponse(HttpStatusCode.OK, list, "application/json")); } }
public HttpResponseMessage getPersonelStock(DTOGetPersonelStock request) { using (var db = new CRMEntities()) { var res = db.getPersonelStock(request.personelid).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, res.Select(r => new { r.productname, r.stockid, r.amount }), "application/json")); } }