public ActionResult Form(long?id) { if (id == null) { List <string> currencyList = new List <string>() { "USD", "BDT" }; ViewBag.BRANCH = new SelectList(db.BRANCHINFO.ToList(), "ID", "BRANCHNAME"); ViewBag.CURRENCY = new SelectList(currencyList); return(View(new DEPOSIT())); } else { DEPOSIT deposit = db.DEPOSIT.Find(id); if (deposit == null) { return(HttpNotFound()); } List <string> currencyList = new List <string>() { "USD", "BDT" }; ViewBag.BRANCH = new SelectList(db.BRANCHINFO.ToList(), "ID", "BRANCHNAME", deposit.BRANCH); ViewBag.CURRENCY = new SelectList(currencyList, null, null, deposit.CURRENCY); return(View(deposit)); } }
// GET: Admin/Payment/Details/5 public ActionResult Details(long?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DEPOSIT deposit = db.DEPOSIT.Find(id); if (deposit == null) { return(HttpNotFound()); } List <string> currencyList = new List <string>() { "USD", "BDT" }; ViewBag.BRANCH = new SelectList(db.BRANCHINFO.ToList(), "ID", "BRANCHNAME", deposit.BRANCH); ViewBag.CURRENCY = new SelectList(currencyList, null, null, deposit.CURRENCY); return(View(deposit)); } catch (Exception exception) { return(RedirectToAction("Error", "Home", new { Area = "" })); } }
public ActionResult Form(DEPOSIT deposit) { try { OCCUSER user = (OCCUSER)Session["User"]; int adminFlag = 0; if (deposit.ID == 0) { deposit.CREATEDBY = user.ID; deposit.ISACTIVE = true; deposit.ISDELETE = false; deposit.ISDOWNLOAD = false; var refNo = DateTime.Now.ToString("ddMMyyHHmmssfff"); //refNo += deposit.CARDNUMBER.Substring(deposit.CARDNUMBER.Length - 4); deposit.REFERENCENUMBER = refNo; db.DEPOSIT.Add(deposit); db.SaveChanges(); // Session["DepositSaveMsg"] = "Data saved successfully.\nReferance Number is: "+deposit.REFERENCENUMBER; var msg = @"Data saved successfully.<br/>Referance Number is: " + deposit.REFERENCENUMBER; if (user.TYPE == 1) { adminFlag = 1; } // return RedirectToAction("Index", "List"); return(Json(new { msg, adminFlag }, JsonRequestBehavior.AllowGet)); } else { if (ModelState.IsValid) { deposit.CREATEDBY = user.ID; deposit.ISACTIVE = true; deposit.ISDELETE = false; deposit.ISDOWNLOAD = false; db.Entry(deposit).State = EntityState.Modified; if (user.TYPE == 1) { adminFlag = 1; } //db.DEPOSIT.AddOrUpdate(x=>x.ID==deposit.ID); db.SaveChanges(); var msg = "Successfully Updated"; return(Json(new { msg, adminFlag }, JsonRequestBehavior.AllowGet)); } List <string> currencyList = new List <string>() { "USD", "BDT" }; ViewBag.BRANCH = new SelectList(db.BRANCHINFO.ToList(), "ID", "BRANCHNAME", db.DEPOSIT.Select(x => x.BRANCH)); ViewBag.CURRENCY = new SelectList(currencyList, null, null, db.DEPOSIT.Select(x => x.CURRENCY)); return(View(deposit)); } } catch (Exception exception) { return(RedirectToAction("Error", "Home", new { Area = "" })); } }
public ActionResult Details(DEPOSIT deposit, string btnName) { try { OCCUSER user = (OCCUSER)Session["User"]; if (String.Equals(btnName, "update")) { DEPOSIT deposits = db.DEPOSIT.Find(deposit.ID); deposit.CREATEDBY = deposits.CREATEDBY; deposit.CREATEDON = deposits.CREATEDON; deposit.MODIFIEDBY = user.ID; deposit.MODIFIEDON = DateTime.Now; deposit.ISACTIVE = true; deposit.ISDELETE = false; //db.Entry(deposit).State = EntityState.Modified; db.DEPOSIT.AddOrUpdate(deposit); db.SaveChanges(); var msg = "Successfully Updated"; return(Json(msg, JsonRequestBehavior.AllowGet)); } if (String.Equals(btnName, "delete")) { DEPOSIT depostis = db.DEPOSIT.Find(deposit.ID); depostis.ISDELETE = true; db.Entry(depostis).State = EntityState.Modified; db.SaveChanges(); var msg = "Successfully Removed"; return(Json(msg, JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Error", "Home", new { Area = "" })); } catch (Exception exception) { var msg = exception.Message; return(Json(msg, JsonRequestBehavior.AllowGet)); } }
Desires_W.Add(new Desire(DEPOSIT, 57));