public ActionResult CreateProcess(FormCollection frm) { int kt = 0; try { int isField = 0; if (frm["cbIsFieldOfProgram"].ToString().Contains("rmb")) { isField = 1; } // TODO: Add insert logic here Models.CauseOfDonation ad = new Models.CauseOfDonation() { Description = frm["Description"], IsFieldOfPrograms = isField, IsDeleted = 0 }; kt = CauseOfDonationBusiness.AddCauseOfDonation(ad); } catch { kt = 0; } if (kt > 0) { return RedirectToAction("ListCause", "CauseOfDonation", new { add = "success" }); } else { return RedirectToAction("ListCause", "CauseOfDonation", new { add = "error" }); } }
public static int EditCauseOfDonation(CauseOfDonation ad) { int upt = 0; try { upt = DataAccessLayer.CauseOfDonationDA.EditCause(ad); } catch (Exception) { return 0; } return upt; }
public static int AddCauseOfDonation(CauseOfDonation ad) { int ins = 0; try { ins = DataAccessLayer.CauseOfDonationDA.AddCause(ad); } catch (Exception) { return 0; } return ins; }
private static List<CauseOfDonation> AddCauseToList(DataTable dt) { List<CauseOfDonation> ls = new List<CauseOfDonation>(); try { for (int i = 0; i < dt.Rows.Count; i++) { CauseOfDonation ad = new CauseOfDonation() { Id = int.Parse(dt.Rows[i]["Id"].ToString()), Description = dt.Rows[i]["Description"].ToString(), IsFieldOfPrograms = int.Parse(dt.Rows[i]["IsFieldOfPrograms"].ToString()), IsDeleted = int.Parse(dt.Rows[i]["IsDeleted"].ToString()) }; ls.Add(ad); } } catch (Exception) { return new List<CauseOfDonation>(); } return ls; }