Example #1
0
        public ActionResult Create([Bind(Include = "ID,Status,Reark,FirstCode,SecondCode,ThirdCode,FourthCode,FifthCode,InfoValue")] Dictionary dictionary)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    dictionary.Status = EnumVal.GetStatusVal(Status.Y);
                    db.Dictionarys.Add(dictionary);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                return(View(dictionary));
            }
            catch (Exception ex) {
                Log.Error("DictionarydController-Create-Post", ex);
                return(View());
            }
        }
Example #2
0
 public ActionResult Create(ViewBill viewBillCreat, string CreatTime)
 {
     try
     {
         if (ModelState.IsValid)
         {
             viewBillCreat.bill.Status        = statusY;
             viewBillCreat.bill.CreatPersonID = userID;
             viewBillCreat.bill.CreatTime     = Convert.ToDateTime(CreatTime);
             string billTypeid = viewBillCreat.typeID;
             viewBillCreat.bill.BillTypeID = Convert.ToInt32(billTypeid);
             db.Bills.Add(viewBillCreat.bill);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex) {
         Log.Error("BillsController-Create-Post", ex);
         return(View());
     }
     return(View());
 }