public ActionResult GetAllTransactionsByDate(DateTime fromDate, DateTime toDate) { dynamic transactions = 0; try { if (ModelState.IsValid) { cashTransactionServiceClient service = new cashTransactionServiceClient(); transactions = service.GetAllTransactionsByDate(fromDate, toDate); //if (customer.Count == 0 || customer == null) //{ // ModelState.AddModelError("error", "No Record Found"); //} } } catch (Exception e) { ModelState.AddModelError("error", "Something Wrong"); transactions = null; throw e; } return(Json(transactions, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteTransaction(int ID) { bool status = false; try { if (ModelState.IsValid) { cashTransactionServiceClient Service = new cashTransactionServiceClient(); status = Service.Delete(ID); } } catch (Exception e) { ModelState.AddModelError("error", "Something Went Wrong"); throw e; } return(View("Index")); }
public ActionResult SaveEdit(CashTransactionModel cashModel) { bool status = true; try { if (ModelState.IsValid) { cashTransactionServiceClient service = new cashTransactionServiceClient(); status = service.SaveEdit(cashModel); } } catch (Exception e) { ModelState.AddModelError("error", "Something Went Wrong"); status = false; throw e; } //return RedirectToAction("Index"); //return View(); return(new JsonResult { Data = new { status = status } }); }