public void UpsertContentSlider(ContentSliders input)
        {
            try
            {
                if (input.Id == null)
                {
                    int seqCtr             = 0;
                    var contentslidersList = (from s in db.ContentSliders
                                              where s.IsDeleted == false
                                              select s.Sequence).ToList();
                    if (contentslidersList.Count > 0)
                    {
                        seqCtr = contentslidersList.Max();
                    }

                    input.Id       = Guid.NewGuid();
                    input.Sequence = seqCtr + 1;

                    db.ContentSliders.Add(input);
                    db.SaveChanges();
                }
                else
                {
                    db.Entry(input).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 public void UpsertTermsOfUse(TermsofUse input)
 {
     try
     {
         if (input.Id == null)
         {
             input.Id = Guid.NewGuid();
             db.TermsofUse.Add(input);
             db.SaveChanges();
         }
         else
         {
             db.Entry(input).State = EntityState.Modified;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public void UpsertFeedback(Feedbacks input)
 {
     try
     {
         if (input.Id == null)
         {
             input.Id = Guid.NewGuid();
             db.Feedbacks.Add(input);
             db.SaveChanges();
         }
         else
         {
             db.Entry(input).State = EntityState.Modified;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void UpsertHomePageSettings(HomePageSettings input)
 {
     try
     {
         if (input.Id == null)
         {
             input.Id = Guid.NewGuid();
             db.HomePageSettings.Add(input);
             db.SaveChanges();
         }
         else
         {
             db.Entry(input).State = EntityState.Modified;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }