Пример #1
0
        protected void saveToContactDB()
        {
            this.contact                = new Business.Contact();
            this.contact.Gender         = this.genderComboBox.Text;
            this.contact.Lastname       = this.lastnameTextBox.Text;
            this.contact.FirstName      = this.firstnameTextBox.Text;
            this.contact.Address        = this.addressTextBox.Text;
            this.contact.City           = this.cityTextBox.Text;
            this.contact.AreaCode       = this.areacodeTextBox.Text;
            this.contact.isBusiness     = this.businessRadioButton.Checked;
            this.contact.LandlineNumber = this.landlineTextBox.Text;
            this.contact.MobileNumber   = this.mobileTextBox.Text;
            this.contact.Company        = this.companyTextBox.Text;
            this.contact.Department     = this.departmentTextBox.Text;

            this._contactRepository.Save(this.contact);
        }
Пример #2
0
        //private readonly ILogger<IndexModel> _Logger;
        //private readonly ApplicationUser _ApplicationUser;

        //public IndexModel(ILogger<IndexModel> logger, ApplicationUser contactService)

        //public ContactService(ApplicationUser applicationUser)
        //{
        //    _ApplicationUser = applicationUser;
        //}

        public Contact Retrieve(int id)
        {
            // private System.Security.Claims.ClaimsPrincipal principal;
            //protected async override void OnParametersSet()
            //{
            //if (authState != null)
            //{
            //System.Security.Claims.ClaimsPrincipal //= (await authState).User;
            //}


            //System.Security.Claims.ClaimsPrincipal _Current = System.Security.Claims.ClaimsPrincipal.Current;

            //ClaimsPrincipal cp = this.User;



            //_HomeViewModel.DistributorId = Convert.ToInt32(
            //       ClaimsPrincipal.Current.Claims.Where(x => x.Type == "CompanyId").Select(c => c.Value).FirstOrDefault()
            //        );


            Business.Contact _Contact = new Business.Contact()
            {
                LastName = "Ugma"
            };

            _Contact.BrokenRulesManager.AddBrokenRule(Core.Validation.RuleSeverity.Information, "This is an information Message");
            //database call


            //throw new NotImplementedException();

            Contact _Result = new Contact()
            {
                LastName = _Contact.LastName
            };

            _Result.BrokenRulesManager.AddBrokenRuleRange(_Contact.BrokenRulesManager.BrokenRulesCollection);


            return(_Result);
        }