Esempio n. 1
0
 /// <summary>
 /// 新增CP
 /// </summary>
 /// <param name="acp"></param>
 /// <returns></returns>
 public bool AddCP(Admin_CPcompany acp)
 {
     DataAccess.Admin_CPcompany cp = new DataAccess.Admin_CPcompany();
     cp.CPname = acp.CPname;
     cp.AddTime = DateTime.Now;
     _db.Admin_CPcompany.AddObject(cp);
     int result = _db.SaveChanges();
     if (result == 1)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 2
0
 public ActionResult AddCP(FormCollection form)
 {
     string cpname = form["CPName"] ?? "";
     if (cpname == "")
     {
         ViewBag.msg = "CP名称不能为空";
         return View();
     }
     else
     {
         Admin_CPcompany acp = new Admin_CPcompany();
         acp.CPname = cpname;
         if (new Admin_CPcompanyLogic().AddCP(acp))
         {
             ViewBag.msg = "CP添加成功";
         }
         else
         {
             ViewBag.msg = "CP添加失败";
         }
         return View();
     }
 }
Esempio n. 3
0
 public ActionResult EditCp(FormCollection form)
 {
     int id = int.Parse(form["cpid"]);
     string cpname = form["cpname"];
     if (new Admin_CPcompanyLogic().UpdateCPbyID(id, cpname))
     {
         ViewBag.msg = "CP更新成功";
     }
     else
     {
         ViewBag.msg = "CP更新失败";
     }
     Admin_CPcompany mm = new Admin_CPcompany();
     return View(mm);
 }