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, }); }
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); } }
public void Add(HomePageAffiliates homePageAffiliates) { _db.HomePageAffiliates.Add(homePageAffiliates); _db.SaveChanges(); }
public void Update(HomePageAffiliates homePageAffiliates) { _db.HomePageAffiliates.Attach(homePageAffiliates); _db.Entry(homePageAffiliates).State = EntityState.Modified; _db.SaveChanges(); }