public bool Add(InterestInputModel interestInputModel) { if (interestInputModel == null) { return(false); } if (_sqlRepository.FirstOrDefault(i => i.InterestName == interestInputModel.InterestName && i.UserId == interestInputModel.UserId) != null) { return(false); } _sqlRepository.Add(interestInputModel.MapTo <Interest>()); return(true); }
public bool Update(InterestInputModel interestInputModel) { if (interestInputModel == null) { return(false); } var interest = _sqlRepository.FirstOrDefault(i => i.InterestName == interestInputModel.InterestName && i.UserId == interestInputModel.UserId); if (interest == null) { return(false); } _sqlRepository.Update(interestInputModel.MapTo(interest)); return(true); }