public ActionResult ApproveReject(string checkList, string comment, string status) { var list = checkList.Split(','); var idList = new int[list.Length]; for (int i = 0; i < idList.Length; i++) { idList[i] = int.Parse(list[i]); } var empNum = Convert.ToInt32(Request.Cookies["Employee"]?["EmpNum"]); if (status == Rejected) { foreach (var id in idList) { var adjustment = _stockAdjustmentRepo.GetById(id); adjustment.Status = status; var itemNum = adjustment.ItemNum; var stationery = _stationeryRepo.GetById(itemNum); stationery.AvailableQty = stationery.AvailableQty - adjustment.Quantity; stationery.CurrentQty = stationery.CurrentQty - adjustment.Quantity; _stationeryRepo.Update(stationery); adjustment.Remark = comment; adjustment.ApprovalDate = DateTime.Today; adjustment.ApprovalEmpNum = empNum; _stockAdjustmentRepo.Update(adjustment); } } else { foreach (var id in idList) { var adjustment = _stockAdjustmentRepo.GetById(id); adjustment.Status = status; adjustment.Remark = comment; adjustment.ApprovalDate = DateTime.Today; adjustment.ApprovalEmpNum = empNum; _stockAdjustmentRepo.Update(adjustment); } } return(PartialView()); }