public void GetAllRiders_Test() { //arrange //act //assert Assert.IsType <List <Rider> >(Rider.GetAllRiders()); }
public long GetRegisteredRidersCount() { long count = 0; try { count = Rider.GetAllRiders().Count; } catch (Exception) { } return(count); }
/// <summary> /// Main Action of the riders controller /// </summary> /// <returns></returns> public ActionResult Index() { try { List <ViewRidersViewModel> model = new List <ViewRidersViewModel>(); foreach (var item in Rider.GetAllRiders()) { model.Add(new ViewRidersViewModel { Contact = item.ContactNumber.LocalFormatedPhoneNumber, Name = item.FullName.FirstName + " " + item.FullName.LastName, Id = item.UserId }); } return(View(model)); } catch (Exception ex) { return(RedirectToAction("ErrorPage", "Error", ex)); } }
public ActionResult SendNotification(SendSmsViewModel model) { if (!ModelState.IsValid) { return(View()); } try { Sms sms; if (model.MessageId != 0) { sms = new Sms(model.MessageId); if (sms.Body != model.Body) { sms = new Sms(DateTime.Now, model.Body); } } else { sms = new Sms(DateTime.Now, model.Body); } if (model.Receiver == SendSmsViewModel.Receivers.All) { foreach (var item in ZATAppApi.Models.User.GetAllUsers()) { SendSMS(sms.Body, item.ContactNumber.PhoneNumberFormat); item.SendSms(sms); } } else if (model.Receiver == SendSmsViewModel.Receivers.Drivers) { foreach (var item in Driver.GetAllDrivers()) { SendSMS(model.Body, item.ContactNumber.PhoneNumberFormat); item.SendSms(sms); } } else if (model.Receiver == SendSmsViewModel.Receivers.Riders) { foreach (var item in Rider.GetAllRiders()) { SendSMS(model.Body, item.ContactNumber.PhoneNumberFormat); item.SendSms(sms); } } else if (model.Receiver == SendSmsViewModel.Receivers.SubAdmin) { foreach (var item in SubAdmin.GetAllSubAdmins()) { SendSMS(model.Body, item.ContactNumber.PhoneNumberFormat); item.SendSms(sms); } } return(View("Confirmation")); } catch (Exception ex) { return(RedirectToAction("ErrorPage", "Error", ex)); } }