Пример #1
0
 public void Insert(FormCollection fc)
 {
     if (fc["NameArea"].ToString() != "")
     {
         Area _pro = new Area()
         {
             IsDeleted = false,
             AreaName = fc["NameArea"].ToString(),
             MetaDescription = fc["MetaDescription"].ToString(),
             Keyword = fc["Keyword"].ToString()
         };
         _AreaService.Add(_pro);
         _unitOfWork.SaveChanges();
     }
     Response.Redirect("Index");
 }
Пример #2
0
 public ActionResult AddArea(string username)
 {
     if(username != "")
     {
     try
     {
         Area s = new Area()
         {
             AreaName = username,
             IsDeleted = false
         };
         _AreaService.Add(s);
         _unitOfWork.SaveChangesAsync();
         Response.Write("Add success!");
         return View("Index");
     }
     catch
     {
     }
     }
     return View();
 }
Пример #3
0
 public void update()
 {
     Area area = new Area();
     if (Request.Params["IdUpdate"].Length > 0)
     {
         int id = int.Parse(Request.Params["IdUpdate"]);
         area = _AreaService.GetById(id);
         if (Request.Params["namearea"].Length > 0)
         {
             area.AreaName = Request.Params["namearea"];
             area.Keyword = Request.Params["Keyword"];
             area.MetaDescription = Request.Params["MetaDescription"];
             _AreaService.UpdateArea(area);
             _unitOfWork.SaveChanges();
         }
     }
     Response.Redirect("Index");
 }