public async Task <IActionResult> ResetPassword([FromBody] ResetPasswordViewModel model) { if (ModelState.IsValid) { FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); //fairfieldAllergeryRepository.GetUseridFromEmail(model.UserName); //var checkPassword = await signInManager.CheckPasswordSignInAsync.PasswordSignInAsync(model.Email, model.Password, true, false); //var user = await userManager.FindByNameAsync(fairfieldAllergeryRepository.GetUseridFromEmail(model.UserName)); var user = await userManager.FindByEmailAsync(model.UserName); //var checkPassword = await signInManager.CheckPasswordSignInAsync(user, model.OldPassword, true); //if (checkPassword.Succeeded) //{ var token = await userManager.GeneratePasswordResetTokenAsync(user); try { } catch (Exception er) { string s1 = er.ToString(); } if (user != null) { var result = await userManager.ResetPasswordAsync(user, token, model.Password); if (result.Succeeded) { if (await userManager.IsLockedOutAsync(user)) { await userManager.SetLockoutEndDateAsync(user, DateTimeOffset.UtcNow); } return(Ok(new { status = "Success" })); } else { return(Ok(new { status = "Failed" })); } } else { return(Ok(new { status = "Failed" })); } //} //else //{ // return Ok(new { status = "Failed" }); //} } else { return(Ok(new { status = "Failed" })); } }
public IActionResult Get(string parametersString) { string[] parts = parametersString.Split('~'); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); List <BroadcastMessage> broadcastMessage = fairfieldAllergeryRepository.GetBroadcastMessage(parts[0], parts[1]); return(Ok(broadcastMessage)); }
public IActionResult Get(string parametersString) { OperationResult operationResult = new OperationResult(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.GetPatients(parametersString); if (operationResult.Success) { return(Ok((IEnumerable <Patient>)operationResult.Patient)); } else { return(Content(HttpStatusCode.NotFound.ToString(), operationResult.ErrorMessage)); } }
public IActionResult Post([FromBody] BroadcastMessage broadcastMessage) { OperationResult operationResult = new OperationResult(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); fairfieldAllergeryRepository.AddBroadcastMessage(broadcastMessage); if (operationResult.Success) { return(Ok(new { status = "Success" })); } else { return(Ok(new { status = "Failure" })); } }
public async Task <IActionResult> Login([FromBody] LoginViewModel model) { if (ModelState.IsValid) { UserInformation userInformation = new UserInformation(); try { //var result = await _signInMgr.PasswordSignInAsync(model.UserName, model.Password, false, false); //var result = await signInManager.PasswordSignInAsync(model.Email, model.Password, true, false); var result = await signInManager.PasswordSignInAsync( model.UserName, model.Password, true, false); //var user = await userManager.FindByNameAsync(.FindByLoginAsync(.FindAsync(context.UserName, context.Password); if (result.Succeeded) { FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); if (fairfieldAllergeryRepository.HasUserChangedIdAndPassword(model.UserName)) { userInformation = fairfieldAllergeryRepository.GetUserInformation(model.UserName); userInformation.Password = model.Password; userInformation.Status = "Success"; return(Ok(userInformation)); //return Ok(new { status = "Success" }); } else { userInformation = fairfieldAllergeryRepository.GetUserInformation(model.UserName); userInformation.Password = model.Password; userInformation.Status = "Change"; return(Ok(userInformation)); } } } catch (Exception ex) { string s1 = ex.ToString(); } } return(Ok(new { status = "Failure" })); }
public IActionResult Post([FromBody] FamilyAccount familyAccount) { OperationResult operationResult = new OperationResult(); string appointmentString = string.Empty; FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.AddFamilyAccount(familyAccount); if (operationResult.Success) { return(Ok(new { status = "Success" })); } else { return(Ok(new { status = operationResult.ErrorMessage })); } }
public IActionResult Get(string parametersString) { OperationResult operationResult = new OperationResult(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.GetUserIdAndPassword(parametersString); if (operationResult.Success) { //return Ok(operationResult.PatientCredentials); return(Ok(operationResult.UserInformation)); } else { return(Content(HttpStatusCode.NotFound.ToString(), operationResult.ErrorMessage)); } }
public IActionResult Post(string parametersString) { OperationResult operationResult = new OperationResult(); string[] values = parametersString.Split('~'); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.UpdateUserName(values[0], values[1], values[2]); if (operationResult.Success) { return(Ok(new { status = "Success" })); } else { return(Ok(new { status = "Failure" })); } }
public IActionResult Get(string parametersString) { string[] parameters = parametersString.Split('~'); OperationResult operationResult = new OperationResult(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.GetExistingAppointments(parameters[0]); if (operationResult.Success) { return(Ok((IEnumerable <Appointment>)operationResult.ExistingAppointments)); } else { return(Content(HttpStatusCode.NotFound.ToString(), operationResult.ErrorMessage)); } }
public IActionResult Put(string id) { OperationResult operationResult = new OperationResult(); string[] words = id.Split('~'); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.UpdatePatientLocation(words[0], words[1]); if (operationResult.Success) { return(Ok(new { status = "Success" })); } else { return(Ok(new { status = "Failure" })); } }
public IActionResult Delete(string parametersString) { string s1 = parametersString.ToString(); OperationResult operationResult = new OperationResult(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.DeleteAppointment(parametersString); if (operationResult.Success) { return(Ok(new { status = "Success" })); } else { return(Ok(new { status = "Failure" })); } }
public IActionResult Put([FromBody] List <AppointmentSlots> appointmentSlots) //public IActionResult Put([FromBody] AppointmentSlots appointmentSlots) { FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); for (int i = 0; i < appointmentSlots.Count; i++) { if (appointmentSlots[i].NewSlotNumber > -1) { OperationResult operationResult = new OperationResult(); operationResult = fairfieldAllergeryRepository.UpdateNumberOfSlots(appointmentSlots[i].SlotId, appointmentSlots[i].NewSlotNumber); } else if (appointmentSlots[i].NumberSlots < 1) { OperationResult operationResult = new OperationResult(); operationResult = fairfieldAllergeryRepository.UpdateNumberOfSlots(appointmentSlots[i].SlotId, 0); } } return(Ok(new { status = "Success" })); }
public async Task <IActionResult> Get(string parametersString) { string[] parameters = parametersString.Split('~'); string arguements = parameters[0] + " " + parameters[1]; OperationResult operationResult = new OperationResult(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.GetPatientAllergyAppointments(parameters[0], parameters[1]); //using (var process = new Process()) //{ // process.StartInfo.FileName = @"C:\waldenltd\FairfieldAllergyApp\ProcessReport\bin\Debug\ProcessReport.exe"; // relative path. absolute path works too. // process.StartInfo.Arguments = arguements; // process.StartInfo.CreateNoWindow = true; // process.StartInfo.UseShellExecute = false; // process.StartInfo.RedirectStandardOutput = true; // process.StartInfo.RedirectStandardError = true; // process.Start(); // var exited = process.WaitForExit(1000 * 3); //} var url = ConfigurationValues.PrintScheduleUrl + parametersString; using var client = new HttpClient(); var response = await client.GetStringAsync(url); string[] responseParts = response.Split('~'); if (operationResult.Success && responseParts[0] == "OK") { return(Ok(new { status = "Success", name = responseParts[1] })); } else { return(Ok(new { status = "No Records", error = operationResult.ErrorMessage })); } }
public IActionResult Post([FromBody] Appointment appointment) { OperationResult operationResult = new OperationResult(); string appointmentString = string.Empty; appointmentString = appointment.AppointmentDescription; appointmentString = appointmentString.Replace("Appt on ", ""); appointmentString = appointmentString.Replace("at ", ""); string[] words = appointmentString.Split(' '); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.AddAppointment(words[3], words[0] + words[1], appointment.Location.ToString(), appointment.UserId.ToString(), appointment.SlotID.ToString()); if (operationResult.Success) { return Ok(new { status = "Success" }); } else { return Ok(new { status = "Failure" }); } }
public IActionResult Get(string parametersString) { string[] parameters = parametersString.Split('~'); /* * string parameters2 = parameters[0].Substring(0, 15); * * string monthString = parameters2.Substring(4, 3); * string dayMonth = parameters2.Substring(7, 8).Replace(" ", "-"); * string newDate = string.Empty; * * switch (monthString) * { * case "Jan": * newDate = "01" + dayMonth; * break; * case "Feb": * newDate = "02" + dayMonth; * break; * case "Mar": * newDate = "03" + dayMonth; * break; * case "Apr": * newDate = "04" + dayMonth; * break; * case "May": * newDate = "05" + dayMonth; * break; * case "Jun": * newDate = "06" + dayMonth; * break; * case "Jul": * newDate = "07" + dayMonth; * break; * case "Aug": * newDate = "08" + dayMonth; * break; * case "Sep": * newDate = "09" + dayMonth; * break; * case "Oct": * newDate = "10" + dayMonth; * break; * case "Nov": * newDate = "11" + dayMonth; * break; * case "Dec": * newDate = "12" + dayMonth; * break; * default: * // code block * break; * } */ OperationResult operationResult = new OperationResult(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.GetAppointmentSlots(parameters[0], parameters[1]); if (operationResult.Success) { return(Ok((IEnumerable <AppointmentSlots>)operationResult.AppointmentSlots)); } else { return(Content(HttpStatusCode.NotFound.ToString(), operationResult.ErrorMessage)); } }
public IActionResult Get(string id) { string [] parts = id.Split('~'); OperationResult operationResult = new OperationResult(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); Patient patient = fairfieldAllergeryRepository.GetPatientNameForEmail(parts[0]); fairfieldAllergeryRepository.UpdateEmail(parts[0], parts[1]); TextWriter htmlDocument = new StreamWriter(@"C:\temp\mail.html"); htmlDocument.WriteLine("<!DOCTYPE HTML PUBLIC " + Chr(34) + "-//W3C//DTD HTML 4.0 Transitional//EN" + Chr(34) + " > "); htmlDocument.WriteLine("<html>"); htmlDocument.WriteLine("<head>"); htmlDocument.WriteLine("<meta http-equiv=" + Chr(34) + "Content-Type" + Chr(34) + " content=" + Chr(34) + "text/html; charset=utf-8" + Chr(34) + " />"); htmlDocument.WriteLine("<title>Single-Column Responsive Email Template</title>"); htmlDocument.WriteLine("<meta name=" + Chr(34) + "viewport" + Chr(34) + " content=" + Chr(34) + "width=device-width, initial-scale=1.0" + Chr(34) + "/>"); htmlDocument.WriteLine("<link href=" + Chr(34) + "Content/bootstrap.min.css" + Chr(34) + " rel=" + Chr(34) + "stylesheet" + Chr(34) + "/>"); htmlDocument.WriteLine("<style>"); htmlDocument.WriteLine("@media only screen and (min-device-width: 541px) {"); htmlDocument.WriteLine(" .content {"); htmlDocument.WriteLine(" width: 540px !important;"); htmlDocument.WriteLine(" }"); htmlDocument.WriteLine(" }"); htmlDocument.WriteLine(" mark.red {"); htmlDocument.WriteLine(" color: #ff0000;"); htmlDocument.WriteLine(" background: none;"); htmlDocument.WriteLine(" }"); htmlDocument.WriteLine(" .wrapper {"); htmlDocument.WriteLine(" text-align: center;"); htmlDocument.WriteLine(" }"); htmlDocument.WriteLine("</style>"); htmlDocument.WriteLine("</head>"); htmlDocument.WriteLine("<body>"); htmlDocument.WriteLine("<!--[if (gte mso 9)|(IE)]>"); htmlDocument.WriteLine(" <table width=" + Chr(34) + "540" + Chr(34) + " align=" + Chr(34) + "center" + Chr(34) + " cellpadding=" + Chr(34) + "0" + Chr(34) + " cellspacing=" + Chr(34) + "0" + Chr(34) + " border=" + Chr(34) + "0" + Chr(34) + ">"); htmlDocument.WriteLine(" <tr>"); htmlDocument.WriteLine(" <td>"); htmlDocument.WriteLine(" <![endif]-->"); htmlDocument.WriteLine(" <table class=" + Chr(34) + "content" + Chr(34) + " align=" + Chr(34) + "center" + Chr(34) + " cellpadding=" + Chr(34) + "0" + Chr(34) + " cellspacing=" + Chr(34) + "0" + Chr(34) + " border=" + Chr(34) + "0" + Chr(34) + " style=" + Chr(34) + "width: 100%; max-width: 540px;" + Chr(34) + ">"); htmlDocument.WriteLine(" <tr>"); htmlDocument.WriteLine(" <td>"); htmlDocument.WriteLine(" <h4 style=" + Chr(34) + "font-weight: bold;" + Chr(34) + ">Id and Password for " + patient.PatientName + "</h4>"); htmlDocument.WriteLine(" <h4 style=" + Chr(34) + "font-weight: bold;" + Chr(34) + ">ID: " + patient.PatientUserId + "</h4>"); htmlDocument.WriteLine(" <h4 style=" + Chr(34) + "font-weight: bold;" + Chr(34) + ">Password: "******"</h4>"); htmlDocument.WriteLine("<br />"); htmlDocument.WriteLine("<br />"); //htmlDocument.WriteLine(" <h4 style=" + Chr(34) + "font-weight: bold;" + Chr(34) + ">To login go to https://myshot.fcaaia.com/FairfieldAllergyPatient"</h4>"); //www.xyz.com/contact.html#name=some_text&email=more%20text htmlDocument.WriteLine(" <h4 style=" + Chr(34) + "font-weight: bold;" + Chr(34) + ">To login go to https://myshotdev.fcaaia.com/FairfieldAllergyPatient#" + patient.PatientUserId + "</h4>"); htmlDocument.WriteLine(" </td>"); htmlDocument.WriteLine(" </tr>"); htmlDocument.WriteLine(" </table>"); htmlDocument.WriteLine("<br />"); htmlDocument.WriteLine("</body>"); htmlDocument.WriteLine("</html>"); htmlDocument.Close(); try { MailMessage message = new MailMessage(); SmtpClient smtp = new SmtpClient(); message.From = new MailAddress("*****@*****.**"); message.To.Add(new MailAddress(parts[1])); message.Subject = "Request for UserName and Password"; message.IsBodyHtml = true; //to make message body as html message.Body = System.IO.File.ReadAllText(@"C:\temp\mail.html"); smtp.Port = 587; smtp.Host = "smtp.siteprotect.com"; //for gmail host smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential("*****@*****.**", "@0Hinckley"); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Send(message); } catch (Exception er) { return(Ok(new { status = "Failure", message = er.ToString() })); } return(Ok(new { status = "Success", message = "None" })); }
private async void ServiceTimer_Tick(object sender, System.Timers.ElapsedEventArgs e) { timer.Stop(); //1. Get new records from Roach //2. Iterate through the records and create id's and passwords //3. Send email to user with information // Generate a random number Random random = new Random(); // Use other methods RandomNumberGenerator generator = new RandomNumberGenerator(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); List <AllergyPatient> allergyPatient = new List <AllergyPatient>(); ConfigurationValues.FairfieldAllergyConnection = System.Configuration.ConfigurationManager.AppSettings["fairfieldDatabaseConnection"]; ConfigurationValues.RegisterUrl = System.Configuration.ConfigurationManager.AppSettings["registerUrl"]; OperationResult getCurrentUserId = fairfieldAllergeryRepository.GetCurrentId(); int currentId = getCurrentUserId.CurrentId; allergyPatient = fairfieldAllergeryRepository.GetListOfNewUsers(currentId.ToString()); for (int i = 0; i < allergyPatient.Count; i++) { //i = 3695; //Console.WriteLine("Begin record: " + i.ToString() + " of " + allergyPatient.Count.ToString()); try { Console.WriteLine(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " Processing record " + i.ToString() + " of " + allergyPatient.Count.ToString()); if (allergyPatient[i].first_name.Length > 0 && allergyPatient[i].last_name.Length > 0) { if (allergyPatient[i].first_name.Length == 1) { allergyPatient[i].first_name = "None"; } if (allergyPatient[i].last_name.Length == 1) { allergyPatient[i].last_name = "None"; } string userID = generator.RandomString(10, false); string password = generator.RandomPassword(); fairfieldAllergeryRepository.CreateNewUser(allergyPatient[i], userID, password); string sex = string.Empty; if (allergyPatient[i].gender == 1) { sex = "M"; } else if (allergyPatient[i].gender == 2) { sex = "F"; } RegisterViewModel registerViewModel = new RegisterViewModel(); registerViewModel.Email = "None"; registerViewModel.FirstName = allergyPatient[i].first_name; registerViewModel.LastName = allergyPatient[i].last_name; if (string.IsNullOrEmpty(allergyPatient[i].home_phone)) { registerViewModel.HomePhone = "0000000000"; } else { registerViewModel.HomePhone = allergyPatient[i].home_phone; } if (sex.Length < 1) { registerViewModel.Sex = "U"; } else { registerViewModel.Sex = sex; } if (string.IsNullOrEmpty(allergyPatient[i].birthday.ToShortDateString())) { registerViewModel.DateOfBirth = " "; } else { registerViewModel.DateOfBirth = allergyPatient[i].birthday.ToShortDateString(); } //registerViewModel.DateOfBirth = allergyPatient[i].birthday.ToShortDateString(); registerViewModel.UserName = userID; registerViewModel.Password = password; registerViewModel.ConfirmPassword = password; var json = JsonConvert.SerializeObject(registerViewModel); var data = new StringContent(json, Encoding.UTF8, "application/json"); var url = ConfigurationValues.RegisterUrl; using var client = new HttpClient(); var response = await client.PostAsync(url, data); string jsonResult = response.Content.ReadAsStringAsync().Result; var result = JsonConvert.DeserializeObject <Status>(jsonResult); Console.WriteLine(result); currentId = allergyPatient[i].pkid; if (result.status == "Failure") { string s2 = string.Empty; } fairfieldAllergeryRepository.UpdateWebIdTableWithGuidFromAspNetUsersTable(userID); } Console.WriteLine("Done with record: " + i.ToString() + " of " + allergyPatient.Count.ToString()); } catch (Exception er) { Console.WriteLine(er.ToString()); } //Need to get GUID in AspNetUsers table and put it into WEBID } if (allergyPatient.Count > 0) { fairfieldAllergeryRepository.UpdateUserId(currentId++); } else { Console.WriteLine("No records to process"); } fairfieldAllergeryRepository.UpdateUsersWithDataFromRoach(); //SQL Access Info //ID: walden //PW: Db#rd!927!Mz //DB Name: RoschIT //172.16.1.13 //Thread.Sleep(3600000); timer.Start(); }
public async Task <IActionResult> ChangeCredentials([FromBody] ChangeCredentialsViewModel model) { ChangeCredentials changeCredentials = new ChangeCredentials(); if (ModelState.IsValid) { UserInformation userInformation = new UserInformation(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); try { var result = await signInManager.PasswordSignInAsync( model.OldUserName, model.OldPassword, true, false); //If signin works if (result.Succeeded) { //Check to see if user llready exists if (fairfieldAllergeryRepository.CheckToSeeIfIdIsAlreadyUsed(model.UserName)) { var user = await userManager.FindByNameAsync(model.OldUserName); var checkPassword = await signInManager.CheckPasswordSignInAsync(user, model.OldPassword, true); if (checkPassword.Succeeded) { var token = await userManager.GeneratePasswordResetTokenAsync(user); if (user != null) { var passwordChangeResult = await userManager.ResetPasswordAsync(user, token, model.Password); if (passwordChangeResult.Succeeded) { //if (await userManager.IsLockedOutAsync(user)) //{ // await userManager.SetLockoutEndDateAsync(user, DateTimeOffset.UtcNow); //} fairfieldAllergeryRepository.UpdateUseridAndPassword(model); } else { userInformation = fairfieldAllergeryRepository.GetUserInformation(model.UserName); userInformation.Status = "Failure"; userInformation.ErrorMessage = "Password change did not succeed"; return(Ok(userInformation)); } } else { userInformation = fairfieldAllergeryRepository.GetUserInformation(model.UserName); userInformation.Status = "Failure"; userInformation.ErrorMessage = "User is null"; return(Ok(userInformation)); } } else { userInformation = fairfieldAllergeryRepository.GetUserInformation(model.UserName); userInformation.Status = "Failure"; userInformation.ErrorMessage = "Password check failed"; return(Ok(userInformation)); } } else { userInformation = fairfieldAllergeryRepository.GetUserInformation(model.UserName); userInformation.Status = "Failure"; userInformation.ErrorMessage = "UserId already taken. Please select another"; return(Ok(userInformation)); } //*************************************************************************************************** if (fairfieldAllergeryRepository.HasUserChangedIdAndPassword(model.UserName)) { userInformation = fairfieldAllergeryRepository.GetUserInformation(model.UserName); userInformation.Status = "Success"; return(Ok(userInformation)); } else { userInformation = fairfieldAllergeryRepository.GetUserInformation(model.UserName); userInformation.Status = "Change"; return(Ok(userInformation)); } } else { changeCredentials.Status = "Failure"; changeCredentials.ErrorMessage = "None"; userInformation = fairfieldAllergeryRepository.GetUserInformation(model.UserName); return(Ok(userInformation)); return(Ok(changeCredentials)); } } catch (Exception ex) { string s1 = ex.ToString(); } } changeCredentials.Status = "Failure"; changeCredentials.ErrorMessage = "None"; return(Ok(changeCredentials)); }
public IActionResult Get(string parametersString) { string[] parameters = parametersString.Split('~'); string parameterTest = parameters[0].Substring(0, 10); DateTime date = Convert.ToDateTime(parameterTest); string parameters2 = parameters[0].Substring(0, 15); string monthString = parameters2.Substring(4, 3); string dayMonth = parameters2.Substring(7, 8).Replace(" ", "-"); string newDate = string.Empty; switch (monthString) { case "Jan": newDate = "01" + dayMonth; break; case "Feb": newDate = "02" + dayMonth; break; case "Mar": newDate = "03" + dayMonth; break; case "Apr": newDate = "04" + dayMonth; break; case "May": newDate = "05" + dayMonth; break; case "Jun": newDate = "06" + dayMonth; break; case "Jul": newDate = "07" + dayMonth; break; case "Aug": newDate = "08" + dayMonth; break; case "Sep": newDate = "09" + dayMonth; break; case "Oct": newDate = "10" + dayMonth; break; case "Nov": newDate = "11" + dayMonth; break; case "Dec": newDate = "12" + dayMonth; break; default: // code block break; } OperationResult operationResult = new OperationResult(); FairfieldAllergeryRepository fairfieldAllergeryRepository = new FairfieldAllergeryRepository(); operationResult = fairfieldAllergeryRepository.GetListOfAppointment(date.ToShortDateString(), parameters[1]); if (operationResult.Success) { return(Ok((IEnumerable <OpenAppointment>)operationResult.Appointments)); } else { return(Content(HttpStatusCode.NotFound.ToString(), operationResult.ErrorMessage)); } }