Beispiel #1
0
 public ActionResult Delete(int id, news_post news)
 {
     try
     {
         newsObj.commitDelete(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #2
0
 public static string Create_News_Post(news_post _news_post)
 {
     try
     {
         _news_post.news_id = Guid.NewGuid().ToString();
         _news_post.post_on = DateTime.Now;
         newsDataContext.news_posts.InsertOnSubmit(_news_post);
         newsDataContext.SubmitChanges();
         return _news_post.news_id;
     }
     catch (Exception ex)
     {
         return string.Format("Fail : {0}",ex.Message);
     }
 }
Beispiel #3
0
 public ActionResult Update(int id, news_post newsUpd)
 {
     if (ModelState.IsValid)
     {
         try
         {
             newsObj.commitUpdate(id, newsUpd.date, newsUpd.heading, newsUpd.details);
             return(RedirectToAction("Details/" + id));
         }
         catch
         {
             return(View());
         }
     }
     return(View());
 }
Beispiel #4
0
 public ActionResult Insert(news_post post)
 {
     if (ModelState.IsValid)
     {
         try
         {
             newsObj.commitInsert(post);
             return(RedirectToAction("Index"));
         }
         catch
         {
             return(View());
         }
     }
     else
     {
         return(View());
     }
 }
Beispiel #5
0
    protected void lbtn_post_Click(object sender, EventArgs e)
    {
        news_post _news_post = new news_post();
        _news_post.subject = tb_title.Text;
        _news_post.body = tb_post.Text;
        _news_post.news_source_id = ddl_source.SelectedValue;
        _news_post.news_type_id = ddl_news_type.SelectedValue;
        _news_post.img_url = tb_image_url.Text;

          String result=  News_Helper.Create_News_Post(_news_post);
          if (result.Contains("Fail"))
          {
          ShowMessageBox(result);
          }
          else
          {
          Reset_Form();
          ShowMessageBox("Post Successfully!");
          }
    }
Beispiel #6
0
 partial void Deletenews_post(news_post instance);
Beispiel #7
0
 partial void Updatenews_post(news_post instance);
Beispiel #8
0
 partial void Insertnews_post(news_post instance);