コード例 #1
0
 public ActionResult Add(About model)
 {
     try
     {
         if (string.IsNullOrEmpty(model.Contents))
         {
             return(Json(new { IsSuccess = false, Message = "Vui lòng thêm nội dung" }, JsonRequestBehavior.AllowGet));
         }
         model.Createddate = DateTime.Now;
         aboutRepository.Add(model);
         return(Json(new { IsSuccess = true, Message = "Thêm mới thành công" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new { IsSuccess = false, Message = "Thêm mới thất bại" }, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #2
0
 public void Add(About about)
 {
     _aboutRepository.Add(about);
 }
コード例 #3
0
 public ResultMessage <About> Add(About data)
 {
     data.isActive = true;
     return(_aboutRepository.Add(data));
 }