public void DeleteAdvertisement(DTO.Advertisement advertisement, DTO.User user) { var repo = UnitOfWork.GetRepository <IAdvertisementRepository>() as IRepository <DAL.Model.Advertisement>; repo.Get(a => AuthenticateUser(advertisement, user, a)); repo.Delete(advertisement.AdvertisementId); UnitOfWork.Save(); }
private static bool AuthenticateUser(DTO.Advertisement advertisement, DTO.User user, DAL.Model.Advertisement a) { return(a.User.Login == user.Login && a.User.Password == user.Password && a.AdvertisementId == advertisement.AdvertisementId); }