Exemplo n.º 1
0
 public static HP_AffiliatesViewModel MapToAffiliatesViewModel(this HomePageAffiliates viewModel)
 {
     return(new HP_AffiliatesViewModel()
     {
         Id = 0,
         ArDescription = viewModel.ArDescription,
         EnDescription = viewModel.EnDescription,
         ImageUrl = viewModel.ImageUrl,
         IsActive = viewModel.IsActive,
         IsDeleted = viewModel.IsDeleted,
         Url = viewModel.Url,
         Type = viewModel.Type,
         HomePageAffiliatesId = viewModel.Id,
         ChangeActionEnum = ChangeActionEnum.New,
         VersionStatusEnum = VersionStatusEnum.Draft,
     });
 }
Exemplo n.º 2
0
        public bool SoftDelete(int id)
        {
            try
            {
                HomePageAffiliates model = _db.HomePageAffiliates.FirstOrDefault(x => x.Id == id);
                if (model != null)
                {
                    model.IsDeleted = true;

                    Update(model);

                    return(true);
                }
                return(false);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 public void Add(HomePageAffiliates homePageAffiliates)
 {
     _db.HomePageAffiliates.Add(homePageAffiliates);
     _db.SaveChanges();
 }
Exemplo n.º 4
0
 public void Update(HomePageAffiliates homePageAffiliates)
 {
     _db.HomePageAffiliates.Attach(homePageAffiliates);
     _db.Entry(homePageAffiliates).State = EntityState.Modified;
     _db.SaveChanges();
 }