I have function to calculate price as follows:
public ActionResult updatePrice(int pageCount,int detid ,int spec)
{
double amt = 0.00;
double final = 0.00;
using(APM context = new APM())
{
var lst = (from s in context.M_Spec
join p in context.M_SpecDetails on s.ID equals p.SpecID
where p.SpecificationID == spec && p.SpecID == detid
select new
{
amount = (double) p.Rate
}).ToList();
foreach( var s in lst)
{
amt = (pageCount - 10) * (s.amount) ;
}
var def = (from s in context.M_Spec where s.ID == detid
select new
{
defamt = (double)s.DefaultCost
}).ToList();
foreach (var s in def)
{
final = (s.defamt) + amt;
}
}
return Json(new { success = true, Amount = final});
}
Finally get the answer like final = 2130.0 and I passed it to the ajax success using json as above and I get the result at ajax success as 2130.How can I overcome this problem?