public void ChangeDisbursementStatustocollectbyDisbursementDetail(DisbursementDetails dd) { Disbursement d = dbcontext.Disbursements.Where(x => x.Id == dd.DisbursementId).FirstOrDefault(); if (d.DisbursementStatus != Enums.DisbursementStatus.COLLECTED) { d.DisbursementStatus = Enums.DisbursementStatus.COLLECTED; } // update associated request status to completed List <Request> requests = dbcontext.Requests.Where(x => x.DisbursementId == d.Id).ToList(); foreach (Request r in requests) { r.Status = Enums.Status.Completed; dbcontext.Update(r); ems.sendCompletedRequestToEmployeeEmail(r); } dbcontext.Update(d); dbcontext.SaveChanges(); }
public void ResetRequestQtyByRetrievalId(int id) { List <InventoryItem> items = adProjContext.RetrievalDetails.Where(x => x.RetrievalId == id).Select(x => x.InventoryItem).ToList(); foreach (InventoryItem item in items) { item.QtyInStock -= item.RequestQty; item.RequestQty = 0; adProjContext.Update(item); } adProjContext.SaveChanges(); }
public void updateStatus(Request request, ADProj.Enums.Status status) { request.Status = status; dbcontext.Update(request); dbcontext.SaveChanges(); }