예제 #1
0
        public ActionResult Details(Guid id)
        {
            var info  = service.GetById(id);
            var model = new ImportantNewsModel().ToModel(info);

            return(View(PluginHelper.GetViewPath(this.GetType(), "Details"), model));
        }
예제 #2
0
        public ActionResult Edit(Guid id)
        {
            ImportantNewsModel model = new ImportantNewsModel();
            var info = service.GetById(id);

            model.Title       = info.Title;
            model.Content     = info.Content;
            model.NewsType    = info.NewsType;
            model.ReleaseTime = info.ReleaseTime;
            model.Id          = info.Id;
            return(View(PluginHelper.GetViewPath(this.GetType(), "Edit"), model));
        }
예제 #3
0
        public ActionResult Delete(Guid id)
        {
            ImportantNewsModel model = new ImportantNewsModel();
            var info = service.GetById(id);

            if (info != null)
            {
                info.IsDelete = true;
                service.Update(info);
                return(Json(new AjaxResult()
                {
                    Result = Result.Success
                }));
            }
            return(View(PluginHelper.GetViewPath(this.GetType(), "Delete"), model));
        }
예제 #4
0
 public ActionResult Create(ImportantNewsModel model)
 {
     if (ModelState.IsValid)
     {
         ImportantNewsInfo info = new ImportantNewsInfo();
         info.Id          = Guid.NewGuid();
         info.Title       = model.Title;
         info.Content     = model.Content;
         info.NewsType    = model.NewsType;
         info.ReleaseTime = model.ReleaseTime;
         service.Add(info);
         return(Json(new AjaxResult()
         {
             Result = Result.Success
         }));
     }
     return(View(PluginHelper.GetViewPath(this.GetType(), "Create"), model));
 }
예제 #5
0
 public ActionResult Edit(ImportantNewsModel model)
 {
     if (ModelState.IsValid)
     {
         var info = service.GetById(model.Id);
         if (info != null)
         {
             info.Id          = model.Id;
             info.Title       = model.Title;
             info.Content     = model.Content;
             info.NewsType    = model.NewsType;
             info.ReleaseTime = model.ReleaseTime;
             service.Update(info);
         }
         return(Json(new AjaxResult()
         {
             Result = Result.Success
         }));
     }
     return(View(PluginHelper.GetViewPath(this.GetType(), "Edit"), model));
 }
예제 #6
0
        public ActionResult Create()
        {
            ImportantNewsModel model = new ImportantNewsModel();

            return(View(PluginHelper.GetViewPath(this.GetType(), "Create"), model));
        }