Example #1
0
 public ActionResult Create(Article article)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _articleService.Add(article);
             TempData["Messeage"] = ValidateMesseage.AddSuccessful;
             return RedirectToAction("Index");
         }
         return View(article);
     }
     catch (WebException ex)
     {
         TempData["Messeage"] = ex.Message;
         return RedirectToAction("Index");
     }
 }
Example #2
0
 public void Update(Article entity)
 {
     _articleRepository.Update(entity);
 }
Example #3
0
 public void Add(Article entity)
 {
     _articleRepository.Insert(entity);
 }
Example #4
0
        public ActionResult Edit(int id, Article article)
        {
            try
            {

                if (ModelState.IsValid)
                {
                    _articleService.Update(article);
                    TempData["Messeage"] = ValidateMesseage.UpdateSuccessful;
                    return RedirectToAction("Index");
                }
                return View(article);
            }
            catch
            {
                return View();
            }
        }