public ActionResult Create([Bind(Include = "ID,Name,Price")] UserData userData) { if (ModelState.IsValid) { userData.PriceinWord = AmountInWords.ConvertToWords(userData.Price); db.Users.Add(userData); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userData)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { AmountInWords amountInWords = new AmountInWords(); if (value is decimal) { return(amountInWords.Read((decimal)value)); } else { return(Binding.DoNothing); } }