Example #1
0
        public ActionResult MaintainKeyword(int?id, string Keyword)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromMinutes(30)))
                {
                    TanKeywords tankewords = new TanKeywords();
                    if (id != null)
                    {
                        tankewords = db.TanKeywords.Find(id);
                    }

                    tankewords.Id      = id == null ? 0 : id.Value;
                    tankewords.keyword = Keyword;
                    if (id == null)
                    {
                        db.TanKeywords.Add(tankewords);
                    }

                    db.SaveChanges();
                    scope.Complete();
                    return(Content("Success"));
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }
Example #2
0
 public ActionResult TanKeyword(int?id)
 {
     try
     {
         if (id != null)
         {
             TanKeywords tanKeyword = db.TanKeywords.Find(id);
             ViewBag.TanKeyword = tanKeyword;
         }
         return(View());
     }
     catch (Exception ex)
     {
         Log.Error(ex);
         throw;
     }
 }
Example #3
0
 public ActionResult DeleteTanKeyword(int?id)
 {
     try
     {
         if (id != null)
         {
             TanKeywords tankeyword = db.TanKeywords.Where(x => x.Id == id).FirstOrDefault();
             db.TanKeywords.Remove(tankeyword);
             db.SaveChanges();
         }
         return(RedirectPermanent("~/Tan/TanKeyword"));
     }
     catch (Exception ex)
     {
         Log.Error(ex);
         throw;
     }
 }