public void Delete(Model.Lot lotModel, Model.User user) { if (lotModel == null) { throw new InvalidOperationException("No lot"); } var lot = genericRepo.Get(l => AuthenticateUser(lotModel, user, l)); if (lot == null) { throw new InvalidOperationException("No such lot"); } genericRepo.Delete(lotModel.LotId); unitOfWork.Save(); }
private bool AuthenticateUser(Model.Lot lotModel, Model.User user, DAL.Model.Lot lot) { return(lot.User.Login == user.Login && lot.User.Password == user.Password && lot.LotId == lotModel.LotId); }