Exemplo n.º 1
0
 public bool Add(tblNewsLetter obj)
 {
     try
     {
         repository.tblNewsLetters.Add(obj);
         repository.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        public JsonResult Active(int id)
        {
            tblNewsLetter ad = dc.tblNewsLetters.SingleOrDefault(ob => ob.NewsLetterId == id);

            if (ad.IsSubscribed == true)
            {
                ad.IsSubscribed = false;
            }
            else
            {
                ad.IsSubscribed = true;
            }
            dc.SaveChanges();
            return(Json(ad.IsSubscribed, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
 public bool Delete(int id)
 {
     try
     {
         tblNewsLetter result = Get(id);
         if (result != null)
         {
             result.Deleted = true;
             repository.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 public bool Update(tblNewsLetter obj)
 {
     try
     {
         tblNewsLetter result = Get(obj.NewsId);
         if (result != null)
         {
             repository.Entry(result).CurrentValues.SetValues(obj);
             repository.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }