Esempio n. 1
0
        public BulkPurchaseForex Save(BulkPurchaseForex model, string action)
        {
            ActionMode mode = (ActionMode)Enum.Parse(typeof(ActionMode), action, true);

            switch (mode)
            {
            case ActionMode.Add:
                BulkPurchaseForexViewModel.Current.AddItem(model);
                return(model);

            case ActionMode.Edit:
                var forex = BulkPurchaseForexViewModel.Current;
                forex.Remove(forex.Where(i => i.Id == model.Id).FirstOrDefault());
                forex.AddItem(model);
                BulkPurchaseForexViewModel.Current = forex;
                return(model);

            case ActionMode.Delete:
                var removeforex = BulkPurchaseForexViewModel.Current;
                removeforex.Remove(removeforex.Where(i => i.Id == model.Id).FirstOrDefault());
                BulkPurchaseForexViewModel.Current = removeforex;
                return(model);

            //case ActionMode.Cancel:
            //    break;
            default:
                break;
            }

            return(null);
        }
Esempio n. 2
0
        private BulkPurchaseForex FindById(int?id = 0)
        {
            BulkPurchaseForex row = new BulkPurchaseForex();

            if (id > 0)
            {
                var forex = BulkPurchaseForexViewModel.Current;
                row = forex.Where(f => f.Id == id).Select(f => f).FirstOrDefault();
                return(row);
            }
            return(row);
        }
Esempio n. 3
0
 public JsonResult ForexSave(BulkPurchaseForex model, string action)
 {
     try
     {
         if (ModelState.IsValid)
         {
             System.Diagnostics.Debug.WriteLine("Forex Save Invoked!!!");
             return(Json(Functions.OutPutResponse(true, "Record saved successfully", _forexmodel.Save(model, action))));
         }
         return(Json(Functions.OutPutResponse(false, "Record saved failed", ModelState)));
     }
     catch (Exception ex)
     {
         return(Json(Functions.OutPutResponse(false, ex.Message)));
     }
 }