public async Task <ServiceResult> AddPhone(PhoneAdd model) { try { Phone phone = new Phone() { BasePrice = model.BasePrice, FinalPrice = model.FinalPrice, StartDate = model.StartDate, EndDate = model.EndDate, sAvailable = model.IsAvailable, KindOfUses = model.KindOfUse, PermanentNumber = model.PermanentNumber, RemainTime = model.RemainTime, UserId = model.UserId }; await _domatelContext.Phones.AddAsync(phone); await _domatelContext.SaveChangesAsync(); return(new ServiceResult { Message = string.Empty, Status = (int)Configuration.ServiceResultStatus.Success }); } catch (Exception e) { return(new ServiceResult { Message = e.Message, Status = (int)Configuration.ServiceResultStatus.Error }); } }
public async Task <ServiceResult> AddPhone(PhoneAdd model) { return(await _phoneRepository.AddPhone(model)); }
//Производим очищение первоначальных данных при нажатии 2 раза ЛКМ private void PhoneAdd_MouseDoubleClick(object sender, MouseButtonEventArgs e) { PhoneAdd.Clear(); }
private void btnAddPhone_Click(object sender, EventArgs e) { PhoneAdd pa = new PhoneAdd(); flpPhoneNumbers.Controls.Add(pa); }
public void SetData() { workingRecord = JsonConvert.DeserializeObject <individual>(JsonConvert.SerializeObject(savedRecord, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })); if (this.InvokeRequired) { this.Invoke(new EventHandler(delegate { SetData(); })); } else { FirstName = savedRecord.firstname; LastName = savedRecord.lastname; Phone = savedRecord.phone; ID = savedRecord.sunshineid; if (null != savedRecord.phonenumbers_individual) { foreach (var item in savedRecord.phonenumbers_individual) { PhoneAdd pa = new PhoneAdd(); pa.SetText(item.phonenumber); flpPhoneNumbers.Controls.Add(pa); } } SetFinancialSupport(savedRecord.financialsupport); if (null != savedRecord.actions_individual) { ICollection <actions_individual> items = new List <actions_individual>(); foreach (var item in savedRecord.actions_individual) { //items.Add(item); } InitializeActionList(items); } foreach (var x in savedRecord.addresses_individual) { if ((bool)x.primary) { StreetPrimary = x.streetAddress; CityPrimary = x.city; cmbState.SelectedIndex = cmbState.FindStringExact(x.state); cmbState.SelectedItem = cmbState.SelectedIndex; ZipPrimary = x.zip; } else { StreetSecondary = x.streetAddress; CitySecondary = x.city; cmbState2.SelectedIndex = cmbState2.FindStringExact(x.state); ZipSecondary = x.zip; } } foreach (var item in savedRecord.social_media_individual) { flpSocial.Controls.Add( new SocialMediaLink(item.sm_title, Encoding.ASCII.GetString(item.sm_link)) { SMType = item.sm_type }); } } }
public void SetData() { workingRecord = JsonConvert.DeserializeObject <organization>(JsonConvert.SerializeObject(savedRecord)); if (this.InvokeRequired) { this.Invoke(new EventHandler(delegate { SetData(); })); } else { wtrOrgName.Text = savedRecord.name; wtrPhone.Text = savedRecord.phone; SetFinancialSupport(savedRecord.financialsupport); if (null != savedRecord.phonenumbers_organization) { foreach (var item in savedRecord.phonenumbers_organization) { PhoneAdd pa = new PhoneAdd(); pa.SetText(item.phonenumber); flpPhoneNumbers.Controls.Add(pa); } } if (null != savedRecord.actions_organization) { ICollection <actions_organization> items = new List <actions_organization>(); foreach (var item in savedRecord.actions_organization) { //items.Add(item); } InitializeActionList(items); } foreach (var x in savedRecord.addresses_organization) { if (x.primary) { wtrStreetAddress.Text = x.streetAddress; wtrCity.Text = x.city; cmbState2.SelectedItem = x.state; wtrZip.Text = x.zip; } else { wtrStreetAddress2.Text = x.streetAddress; wtrCity.Text = x.city; cmbState2.SelectedItem = x.state; wtrZip.Text = x.zip; } } foreach (var item in savedRecord.social_media_organization) { flpSocial.Controls.Add( new SocialMediaLink(item.sm_title, Encoding.ASCII.GetString(item.sm_link)) { SMType = item.sm_type }); } } }
public async Task <ServiceResult> PostPhone(PhoneAdd model) { return(await _phoneService.AddPhone(model)); }