public bool Add(IncomeRecordModel smodel) { connection(); SqlCommand cmd = new SqlCommand("AddIncomeRecord", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@idUser", 1); cmd.Parameters.AddWithValue("@detail", smodel.detail); cmd.Parameters.AddWithValue("@amount", smodel.amount); cmd.Parameters.AddWithValue("@paymentDate", smodel.paymentDate); con.Open(); int i = cmd.ExecuteNonQuery(); con.Close(); if (i >= 1) { return(true); } else { return(false); } }
public ActionResult Edit(int id, IncomeRecordModel smodel) { try { IncomeRecordDBHandle sdb = new IncomeRecordDBHandle(); sdb.UpdateDetails(smodel); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(IncomeRecordModel smodel) { try { if (ModelState.IsValid) { IncomeRecordDBHandle sdb = new IncomeRecordDBHandle(); if (sdb.Add(smodel)) { ViewBag.Message = "Details Added Successfully"; ModelState.Clear(); } } return(View()); } catch (Exception e) { e.GetBaseException(); return(View()); } }