Пример #1
0
 public ActionResult AppHomePage(appModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             model.thongtinkhaibao.TrangThai = "Chưa duyệt";
             db.ThongTinKhaiBaos.Add(model.thongtinkhaibao);
             db.SaveChanges();
             ModelState.Clear();
             IEnumerable <SelectListItem> tochuc = db.ToChucHoTroes.Select(
                 b => new SelectListItem {
                 Value = b.TenToChuc, Text = b.TenToChuc
             });
             ViewData["ToChuc"] = tochuc;
             return(View(model));
         }
         catch (Exception ex)
         {
             ViewBag.error = "Lỗi hệ thống, vui lòng liên hệ quản trị";
             return(View());
         }
     }
     else
     {
         ViewBag.error = "Lỗi hệ thống, vui lòng liên hệ quản trị";
         return(View());
     }
 }
Пример #2
0
 public ActionResult AppHomePage()
 {
     if (ModelState != null)
     {
         try
         {
             appModel model = new appModel();
             model.tochuchotro     = db.ToChucHoTroes.ToList();
             model.thongtinkhaibao = null;
             IEnumerable <SelectListItem> tochuc = db.ToChucHoTroes.Select(
                 b => new SelectListItem {
                 Value = b.TenToChuc, Text = b.TenToChuc
             });
             ViewData["ToChuc"] = tochuc;
             return(View(model));
         }
         catch (Exception ex)
         {
             return(View());
         }
     }
     else
     {
         return(View());
     }
 }
        public string Sum(string firstNumber, string secondNuber)
        {
            var V = new appModel(firstNumber, secondNuber);

            if (V.Validation)
            {
                return("soma é :" + V.Result);
            }

            return("0");
        }