public ActionResult Submit(ParaViewModel pModel) { LawDBEntities objLaw = new LawDBEntities(); pModel = getUpdatedList(pModel, objLaw); if (pModel.paraRightList.Count() > 0) { foreach (var item in pModel.paraRightList) { pModel.ParaSelectedList = (from x in objLaw.tblParas where x.ParaID == item.Value select x.ParaText).ToList(); } StringBuilder sb = new StringBuilder(); foreach (var item in pModel.ParaSelectedList) { sb.Append(item); sb.Append('\n'); } pModel.ParaListForTextArea = sb.ToString(); } return(View(pModel)); }
public ActionResult ShowPara() { ParaViewModel paraVM = new ParaViewModel(); //ParaDAL objDal = new ParaDAL(); LawDBEntities objLaw = new LawDBEntities(); //executes the stored proc sp_ProcInitialize objLaw.sp_ProcInitialize(); //Loads the table tblParaLeft into the paraLeftList //List<tblParaLeft> paraLeftList = new List<tblParaLeft>(); paraVM.paraLeftList = objLaw.tblParaLefts .ToList <tblParaLeft>() .Select(x => new SelectListItem { Value = x.ParaID, Text = x.ParaID }); paraVM.paraRightList = objLaw.tblParaRights .ToList <tblParaRight>() .Select(x => new SelectListItem { Value = x.ParaID, Text = x.ParaID }); return(View(paraVM)); }
public ActionResult Yatir(ParaViewModel model) { BusinessLayerResult <ParaViewModel> layerResult = new BusinessLayerResult <ParaViewModel>(); if (ModelState.IsValid) { if (Decimal.Parse(model.Tutar) == 0) { layerResult.Errors.Add("0'dan başka bir tutar giriniz"); } else { long hesap = model.ParaHesapNo; Hesap hes = hesapManager.Find(x => x.HesapNo == hesap); decimal para = Decimal.Parse(model.Tutar); hes.Bakiye = (hes.Bakiye + para); hesapManager.Update(hes); return(RedirectToAction("Index")); } if (layerResult.Errors.Count > 0) { layerResult.Errors.ForEach(x => ModelState.AddModelError("", x)); return(View(model)); } return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Remove(ParaViewModel pModel) { LawDBEntities objLaw = new LawDBEntities(); if (pModel.SelectedParaRightID != null) { foreach (var item in pModel.SelectedParaRightID.Distinct()) { objLaw.SP_ProcMove("REMOVE", item); } objLaw.SaveChanges(); } //calls the method getUpdatedList that Gets the updated RightPara list and LeftPara list from the database pModel = getUpdatedList(pModel, objLaw); return(View(pModel)); }
/// <summary> /// Makes DB calls to fetch the updated data from the tables tblParaLeft and tblParaRight /// </summary> /// <param name="pVM"></param> /// <param name="objLaw"></param> /// <returns></returns> public ParaViewModel getUpdatedList(ParaViewModel pVM, LawDBEntities objLaw) { pVM.paraLeftList = objLaw.tblParaLefts .ToList <tblParaLeft>() .Select(x => new SelectListItem { Value = x.ParaID, Text = x.ParaID }); pVM.paraRightList = objLaw.tblParaRights .ToList <tblParaRight>() .Select(x => new SelectListItem { Value = x.ParaID, Text = x.ParaID }); return(pVM); }
public ActionResult Yatir(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Hesap hesap = hesapManager.Find(x => x.HesapID == id.Value); ParaViewModel model = new ParaViewModel(); model.ParaHesapNo = hesap.HesapNo; model.Bakiye = hesap.Bakiye; if (hesap == null) { return(HttpNotFound()); } return(View(model)); }