public async Task <IActionResult> PutCustomerClub([FromRoute] int id, [FromBody] CustomerClub customerClub) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customerClub.Customer_Club_Id) { return(BadRequest()); } _context.Entry(customerClub).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerClubExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void SendToCategories() { var token = GetToken(); if (string.IsNullOrWhiteSpace(token)) { throw new Exception($@"{nameof(token) } is null"); } var customerClubSendToCategories = new CustomerClubSendToCategories() { Messages = "ارسال به گروه باشگاه", contactsCustomerClubCategoryIds = new List <int>() { 44 }.ToArray(), SendDateTime = null, CanContinueInCaseOfError = false }; CustomerClubSendResponse customerClubContactResponse = new CustomerClub().SendToCategories(token, customerClubSendToCategories); if (customerClubContactResponse == null) { throw new Exception($@"{nameof(customerClubContactResponse) } is null"); } if (customerClubContactResponse.IsSuccessful) { } else { } }
public async Task <IActionResult> PostCustomerClub([FromBody] CustomerClub customerClub) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Customer_club.Add(customerClub); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCustomerClub", new { id = customerClub.Customer_Club_Id }, customerClub)); }
public bool Sendsms(string phoneNumber, string message, int cat, string fname, string lname) { var result = new Response(); try { SmsIrRestful.Token tokenInstance = new SmsIrRestful.Token(); var token = tokenInstance.GetToken("ca3434a7ac76118b40a34a7", "tVuqAmCHGb@Dwy3m#cXmMm"); int category = 49512; if (cat == 1) // tamland { category = 49512; } SmsIrRestful.CustomerClubContact contact = new SmsIrRestful.CustomerClubContact(); var s = contact.Create(token, new CustomerClubContactObject() { Mobile = phoneNumber, CategoryId = category, FirstName = fname, LastName = lname }); var customerClubSend = new CustomerClubSend() { Messages = new List <string>() { message }.ToArray(), MobileNumbers = new List <string>() { phoneNumber }.ToArray(), SendDateTime = null, CanContinueInCaseOfError = false }; var customerClubContactResponse = new CustomerClub().Send(token, customerClubSend); // result.Code = (int)ResponseType.Ok; // result.Message = customerClubContactResponse.Message; return(customerClubContactResponse.IsSuccessful); // return Ok(result); } catch (Exception e) { var result2 = new Response(); result2.Code = 400; result2.Message = e.Message; return(false); } }
public void AddContactAndSend() { var token = GetToken(); if (string.IsNullOrWhiteSpace(token)) { throw new Exception($@"{nameof(token) } is null"); } List <CustomerClubInsertAndSendMessage> customerClubInsertAndSendMessageList = new List <CustomerClubInsertAndSendMessage>(); customerClubInsertAndSendMessageList.Add( new CustomerClubInsertAndSendMessage() { Prefix = "آقای", FirstName = "یونس ", LastName = "بقائی مقدم", Mobile = "09120000001", BirthDay = null, CategoryId = 44, MessageText = " ثبت مشتری و ارسال" }); CustomerClubSendResponse customerClubContactResponse = new CustomerClub().AddContactAndSend(token, customerClubInsertAndSendMessageList.ToArray()); if (customerClubContactResponse == null) { throw new Exception($@"{nameof(customerClubContactResponse) } is null"); } if (customerClubContactResponse.IsSuccessful) { } else { } }
public void Send() { var token = GetToken(); if (string.IsNullOrWhiteSpace(token)) { throw new Exception($@"{nameof(token) } is null"); } var customerClubSend = new CustomerClubSend() { Messages = new List <string>() { "تست باشگاه" }.ToArray(), MobileNumbers = new List <string>() { "09120000001" }.ToArray(), SendDateTime = null, CanContinueInCaseOfError = false }; CustomerClubSendResponse customerClubContactResponse = new CustomerClub().Send(token, customerClubSend); if (customerClubContactResponse == null) { throw new Exception($@"{nameof(customerClubContactResponse) } is null"); } if (customerClubContactResponse.IsSuccessful) { } else { } }