Exemplo n.º 1
0
        public async Task <ActionResult> Edit(int id, PatientPayloadViewModel model)
        {
            try
            {
                var result = await _patientHandler.UpdatePatient(model);

                return(RedirectToAction(nameof(Create)));
            }
            catch
            {
                return(RedirectToAction(nameof(Create)));
            }
        }
Exemplo n.º 2
0
        public async Task <bool> UpdatePatient(PatientPayloadViewModel patient)
        {
            HttpResponseMessage res = await _apiAccessor.GetHttpClient().PutAsJsonAsync <PatientPayloadViewModel>("Patient/update", patient);

            if (res.IsSuccessStatusCode)
            {
                var empResponse = res.Content.ReadAsStringAsync().Result;

                var newPatient = JsonConvert.DeserializeObject <PatientPayloadViewModel>(empResponse);

                return(true);
            }

            return(false);
        }
        public ActionResult Edit(int id, PatientPayloadViewModel model)
        {
            try
            {
                var result = _patientHandler.UpdatePatient(model);

                if (result)
                {
                    return(RedirectToAction(nameof(Create)));
                }

                return(View(model));
            }
            catch
            {
                return(RedirectToAction(nameof(Create)));
            }
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Create(PatientPayloadViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var result = await _patientHandler.AddPatient(model);

                    return(RedirectToAction(nameof(Create)));
                }
                catch
                {
                    return(View());
                }
            }
            else
            {
                ModelState.AddModelError("Error", "Please enter all the required fields");
                return(View(model));
            }
        }
Exemplo n.º 5
0
 public dynamic UpdatePatient(PatientPayloadViewModel patient)
 {
     return(null);
 }