public BulkPurchasePayment Save(BulkPurchasePayment model, string action) { ActionMode mode = (ActionMode)Enum.Parse(typeof(ActionMode), action, true); switch (mode) { case ActionMode.Add: BulkPurchasePaymentViewModel.Current.AddItem(model); return(model); case ActionMode.Edit: var payment = BulkPurchasePaymentViewModel.Current; payment.Remove(payment.Where(i => i.Id == model.Id).FirstOrDefault()); payment.AddItem(model); BulkPurchasePaymentViewModel.Current = payment; return(model); case ActionMode.Delete: var removepayment = BulkPurchasePaymentViewModel.Current; removepayment.Remove(removepayment.Where(i => i.Id == model.Id).FirstOrDefault()); BulkPurchasePaymentViewModel.Current = removepayment; return(model); //case ActionMode.Cancel: // break; default: break; } return(null); }
public static void ClearSession() { if (BulkPurchasePaymentViewModel.Current != null) { BulkPurchasePaymentViewModel.Current.Clear(); BulkPurchasePaymentViewModel.Current = null; } }
public BulkPurchasePaymentList Delete(int id) { var payment = BulkPurchasePaymentViewModel.Current; var row = FindById(id); payment.Remove(row); BulkPurchasePaymentViewModel.Current = payment; return(BulkPurchasePaymentViewModel.Current); }
public BulkPurchasePaymentList DeleteAll() { var payment = BulkPurchasePaymentViewModel.Current; foreach (var row in payment) { payment.Remove(row); } BulkPurchasePaymentViewModel.Current = payment; return(BulkPurchasePaymentViewModel.Current); }