Ejemplo n.º 1
0
        public ActionResult Update(int id)
        {
            /*this method is used to show the base info of an individual doctor and also gives the user to select a speciality.
             * Hence, We need a ViewModel*/
            string       query          = "Select * from doctors where DoctorID=@id";
            SqlParameter parameter      = new SqlParameter("@id", id);
            Doctor       selecteddoctor = db.Doctors.SqlQuery(query, parameter).FirstOrDefault();

            string            secondquery        = "Select * from specialities";
            List <Speciality> selectedspeciality = db.Specialities.SqlQuery(secondquery).ToList();
            var UpdateDoctor = new UpdateDoctor();

            UpdateDoctor.doctor       = selecteddoctor;
            UpdateDoctor.specialities = selectedspeciality;
            return(View(UpdateDoctor));
        }
        public ResponseResult <Cookie> Put([FromBody] UpdateDoctor updateDoctorInfo)
        {
            ResponseResult <Cookie> result        = new ResponseResult <Cookie>();
            DoctorService           doctorService = new DoctorService();

            try
            {
                result.Result    = null;
                result.IsSuccess = doctorService.UpdateInfo(updateDoctorInfo);
            }
            catch (Exception e)
            {
                result.IsSuccess = false;
                result.Message   = e.Message;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public Doctor UpdateDoc(UpdateDoctor request)
        {
            var d = context.Doctor.FirstOrDefault(a => a.IdDoctor == request.IdDoctor);

            if (d != null)
            {
                d.FirstName = request.FirstName;
                d.LastName  = request.LastName;
                d.Email     = request.Email;

                context.Update(d);
                context.SaveChanges();

                return(d);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        public async Task <bool> UpdateDoctorAsync(string firstName, string lastName, string phoneNumber, string email, string description, ImageSource photo, string token)
        {
            UpdateDoctor updateModel = new UpdateDoctor
            {
                firstName   = firstName,
                lastName    = lastName,
                email       = email,
                phoneNumber = phoneNumber,
                description = description
            };

            client.DefaultRequestHeaders.Clear();
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
            var         jsonDoctor = JsonConvert.SerializeObject(updateModel);
            HttpContent content    = new StringContent(jsonDoctor);

            content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
            var respons = await client.PutAsync(updateDoctor, content);

            return(respons.IsSuccessStatusCode);
        }
Ejemplo n.º 5
0
        public bool UpdateInfo(UpdateDoctor updateDoctor)
        {
            bool result = false;

            using (SqlConnection con = new SqlConnection(connectionString))

            {
                SqlCommand cmd = new SqlCommand("Update_DoctorInfo", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@UserId", updateDoctor.UserId);
                cmd.Parameters.AddWithValue("@Experience", updateDoctor.Experience);
                cmd.Parameters.AddWithValue("@Qualification", updateDoctor.Qualification);
                con.Open();
                //cmd.ExecuteNonQuery();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    result = Convert.ToBoolean(rdr["Status"]);
                }
                con.Close();
            }
            return(result);
        }
        public void UpdateDoctor()
        {
            GetDoctor    doctor       = new GetDoctor(client);
            UpdateDoctor updateDoctor = new UpdateDoctor(client);

            var dr = doctor.Do("MWBywMkevROEsmY4ubha7yXBZms1").Result;

            updateDoctor.Do("MWBywMkevROEsmY4ubha7yXBZms1", new Domain.Models.Doctor
            {
                FirstName = "Fatih1",
                LastName  = "Yýldýz1",
                Email     = "*****@*****.**",
                Phone     = 55606582,
                Degree    = "DRdegreeTest"
            }).Result.ToString();

            var drUpdated = doctor.Do("MWBywMkevROEsmY4ubha7yXBZms1").Result;

            Assert.AreEqual(dr.Email, drUpdated.Email);
            Assert.AreNotEqual(dr.Degree, drUpdated.Degree);
            Assert.AreEqual(dr.FirstName, drUpdated.FirstName);
            Assert.AreEqual(dr.LastName, drUpdated.LastName);
            Assert.AreEqual(dr.Phone, drUpdated.Phone);
        }
Ejemplo n.º 7
0
 public IActionResult UpdateDoctor(UpdateDoctor request)
 {
     return(Ok(service.UpdateDoc(request)));
 }