示例#1
0
 public ActionResult Create(FormCollection collection)
 {
     try
     {
         var costService = new CostService();
         var cost        = new BI_K3_Costs()
         {
             BI_CostID = 0,
             Role_Type = collection["role_type"],
             Role_Name = collection["role_name"]
         };
         if (collection["daily_cost"] != null)
         {
             cost.Daily_Cost = decimal.Parse(collection["daily_cost"]);
         }
         if (collection["hourly_cost"] != null)
         {
             cost.Hourly_Cost = decimal.Parse(collection["hourly_cost"]);
         }
         costService.InsertCost(cost);
         return(RedirectToAction("Index"));
     }
     catch (Exception exception)
     {
         return(View());
     }
 }