public string DeleteAds(int iD) { try { Ad ad = db.Ads.First(x => x.ID == iD); string imagePath = ad.ImagePath; ad.isDeleted = true; ad.DeletedDate = DateTime.Now; ad.LastUpdateDate = DateTime.Now; ad.LastUpdateUserID = UserStatic.UserID; db.SaveChanges(); return(imagePath); } catch (Exception ex) { throw ex; } }
public string UpdateAds(AdsDTO model) { try { Ad ads = db.Ads.First(x => x.ID == model.ID); string oldiamagepath = ads.ImagePath; ads.Name = model.Name; ads.Link = model.Link; if (model.ImagePath != null) { ads.ImagePath = model.ImagePath; } ads.Size = model.Imagesize; ads.LastUpdateDate = DateTime.Now; ads.LastUpdateUserID = UserStatic.UserID; db.SaveChanges(); return(oldiamagepath); } catch (Exception ex) { throw ex; } }