public static bool validateMemberProductModel(MemberProductModel MemberProductModel) { var validationResults = new List <ValidationResult>(); //validate MemberProductModel var validationContext = new ValidationContext(MemberProductModel, serviceProvider: null, items: null); bool isValid = System.ComponentModel.DataAnnotations.Validator.TryValidateObject(MemberProductModel, validationContext, validationResults, true); return(isValid); }
public static MemberProductContract ToMemberProductContract(this MemberProductModel memProductModel) { return(new MemberProductContract { MemberID = memProductModel.MemberID, RefProductID = memProductModel.RefProductID, IsMemberProductActive = memProductModel.IsMemberProductActive, MemberProductValue = memProductModel.MemberProductValue }); }
public bool UpdateMemberProduct(MemberProductModel memberProduct) { if (MemberProductValidation.validateMemberProductModel(memberProduct)) { int currentUserMemberId = _asaMemberAdapter.GetMemberIdFromContext(); memberProduct.MemberID = currentUserMemberId; return(_asaMemberAdapter.UpdateMemberProduct(memberProduct)); } return(false); }
public bool UpdateMemberProduct(MemberProductModel memberProduct) { bool result = SaltServiceAgent.UpdateMemberProduct(memberProduct.ToMemberProductContract()); return(result); }
/// <summary> /// Adds member product /// </summary> /// <param name="memberProduct"></param> /// <returns>bool</returns> public bool AddMemberProduct(MemberProductModel memberProduct) { throw new NotImplementedException(); }