Exemplo n.º 1
0
        public bool UpdateUser(User user)
        {
            var userDto = new UserDto();

            userDto = convert.ToUserDto(user);
            var model = new bool();

            using (var client = new UserService.UserServiceClient())
            {
                try
                {
                    client.Open();
                    model = client.UpdateUser(userDto);
                    client.Close();
                }

                catch (FaultException <CustomException> customEx)
                {
                    log.Error(customEx.Message);
                    return(false);
                }
                catch (CommunicationException commEx)
                {
                    log.Error(commEx.Message);
                    return(false);
                }
            }
            return(model);
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id, UserModel user)
        {
            try
            {
                User usuario = new User();
                usuario.Id              = user.Id;
                usuario.Nombre          = user.Nombre;
                usuario.TipoDocumento   = user.TipoDocumento;
                usuario.NumeroDocumento = user.NumeroDocumento;
                usuario.FechaNacimiento = user.FechaNacimiento;
                usuario.Pais            = user.Pais;
                usuario.Departamento    = user.Departamento;
                usuario.Ciudad          = user.Ciudad;
                usuario.Direccion       = user.Direccion;


                ResponseService response = serviceClient.UpdateUser(user.Id, usuario);
                if (response.Code == 0)
                {
                    return(RedirectToAction("Index", "User"));
                }
                return(View());
            }
            catch
            {
                return(View());
            }
        }
        protected void Button5_Click(object sender, EventArgs e)
        {
            Panel1.Visible = false;
            Panel2.Visible = false;
            Panel3.Visible = false;
            Panel4.Visible = true;
            UserService.IUserService client = new UserService.UserServiceClient();
            UserService.UserInfo     user   = new UserService.UserInfo();
            user.Type   = UserService.UserType.Student;
            user.Std    = Convert.ToInt32(TextBox6.Text);
            user.ID     = Convert.ToInt32(TextBox8.Text);
            user.Name   = TextBox2.Text;
            user.Gender = TextBox3.Text;
            String Text = "22/11/2009";

            user.DOB = DateTime.ParseExact(Text, "dd/MM/yyyy", null);
            client.UpdateUser(user);
            Label1.Text = "Student updated successfully!!";
        }