public JsonResult getcomparison(string strfromval, string strtoval, string strFCurr, string strTcurr, string strlist) { JavaScriptSerializer serializer = new JavaScriptSerializer(); List <SortList> ListAnswers = serializer.Deserialize <List <SortList> >(strlist); MoneyScannerEntities mse = new MoneyScannerEntities(); var getfrocurry = mse.TransferBases.Where(m => m.FromCurrency == strFCurr && m.ToCurrency == strTcurr); List <CompareModel> lstcrl = new List <CompareModel>(); foreach (var g in getfrocurry) { CompareModel cm = new CompareModel(); cm.ImageName = g.Provider.ProviderLogo; cm.rating = Convert.ToString(g.Provider.ProviderRating); cm.todaysrate = Convert.ToString(g.ToValue); cm.transferfee = Convert.ToString(g.TransferFee); cm.transfercurrency = g.TransferCurrency; if (g.TransferDuration < 24) { cm.transfertime = string.Format("{0} Hour(s)", Convert.ToString(g.TransferDuration)); } else { cm.transfertime = string.Format("{0} Day(s)", Convert.ToString(g.TransferDuration / 24)); } cm.send = g.Websitelink; cm.amountreceived = Convert.ToString(Convert.ToDecimal(strfromval) * g.ToValue); lstcrl.Add(cm); } IEnumerable <CompareModel> querysorted = null; IOrderedEnumerable <CompareModel> lstsorted = null; if (ListAnswers.Count > 0) { foreach (SortList sl in ListAnswers) { var propertyInfo = typeof(CompareModel).GetProperty(sl.strKey); if (sl.strSort.ToUpper() == "ASC") { lstsorted = lstcrl.OrderBy(x => propertyInfo.GetValue(x, null)); } else { lstsorted = lstcrl.OrderByDescending(x => propertyInfo.GetValue(x, null)); } } } else { lstsorted = lstcrl.OrderByDescending(x => x.amountreceived); } querysorted = lstsorted; return(Json(querysorted, JsonRequestBehavior.AllowGet)); }
public JsonResult GetToCur(string strfrom) { MoneyScannerEntities mse = new MoneyScannerEntities(); var gettocurry = mse.TransferBases.Where(m => m.FromCurrency == strfrom).Select(m => m.ToCurrency).Distinct(); return(Json(gettocurry, JsonRequestBehavior.AllowGet)); }
public JsonResult GetFromCur() { MoneyScannerEntities mse = new MoneyScannerEntities(); var getfromcurr = mse.TransferBases.Select(m => m.FromCurrency).Distinct(); return(Json(getfromcurr, JsonRequestBehavior.AllowGet)); }
public JsonResult getfromvalue(string strtoval, string strFCurr, string strTcurr) { MoneyScannerEntities mse = new MoneyScannerEntities(); var getfrocurry = mse.TransferBases.Where(m => m.FromCurrency == strFCurr && m.ToCurrency == strTcurr).OrderByDescending(x => x.ToValue).Select(m => m.ToValue).First(); var finalval = Convert.ToDecimal(strtoval) / getfrocurry.Value; return(Json(finalval, JsonRequestBehavior.AllowGet)); }
public JsonResult contactusdetails(string name, string emailid, string phoneno, string messagetext) { ContactU contactus = new ContactU(); contactus.Name = name; contactus.EmailId = emailid; contactus.Phone = phoneno; contactus.Message = messagetext; MoneyScannerEntities mse = new MoneyScannerEntities(); try { mse.ContactUs.Add(contactus); mse.SaveChanges(); return(Json("Succeeded", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json("Failed", JsonRequestBehavior.AllowGet)); } }