public ActionResult Create([ModelBinder(typeof(NewPatientModelBinder))] NewPatientModel patient)
        {
            if (ModelState.IsValid)
            {
                var record = this.petRegistry.NewRecord(new Pet(
                                                            id: Guid.NewGuid(),
                                                            name: patient.Name,
                                                            birthday: patient.Birthday,
                                                            sex: patient.Sex,
                                                            kind: patient.Kind,
                                                            description: patient.Description,
                                                            image: patient.Image.FileName,
                                                            getOwner: () => new Owner( // todo: hardcoded owner
                                                                id: Guid.NewGuid(),
                                                                name: "Marina",
                                                                surname: "Brain",
                                                                address: new Address(
                                                                    city: "Chernigiv",
                                                                    street: "Radchenko",
                                                                    building: "1",
                                                                    addressLine: "2"))));

                return(this.View("Success"));
            }

            return(this.View("NewPatient", patient));
        }
Example #2
0
        async void OnAddPatientClicked(object sender, EventArgs e)
        {
            if (patientName.Text == null)
            {
                Console.WriteLine("Patient name not supplied");

                return;
            }

            NewPatientModel patient = new NewPatientModel();

            patient.name = patientName.Text;

            await App.patientManager.InsertPatientAsync(patient);

            await Navigation.PopAsync();
        }
Example #3
0
        public async Task AddPatientAsync(NewPatientModel patient)
        {
            Uri uri = new Uri($"{restURL}api/communication");

            try
            {
                string        json    = JsonConvert.SerializeObject(patient);
                StringContent content = new StringContent(json, Encoding.UTF8, "application/json");

                HttpResponseMessage msg = await client.PostAsync(uri, content);

                if (msg.IsSuccessStatusCode)
                {
                    Debug.WriteLine(@"\tUser logged in successfully.");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"\tERROR {ex.Message}");
            }

            return;
        }
Example #4
0
 public Task InsertPatientAsync(NewPatientModel patient)
 {
     return(rest.AddPatientAsync(patient));
 }