// This is the Delete methd to delete the selected Cliente item
        // USAGE: <asp:FormView DeleteMethod="DeleteItem">
        public void DeleteItem(int cd_cliente)
        {
            using (var context = new renan004Context())
            {
                var item = context.Cliente.Find(cd_cliente);

                if (item != null)
                {
                    context.Cliente.Remove(item);
                    context.SaveChanges();
                }
            }
            Response.Redirect("../Default");
        }
        // This is the Insert method to insert the entered Cliente item
        // USAGE: <asp:FormView InsertMethod="InsertItem">
        public void InsertItem()
        {
            using (var context = new renan004Context())
            {
                var item = new Cliente();

                TryUpdateModel(item);

                if (ModelState.IsValid)
                {
                    // Save changes
                    context.Cliente.Add(item);
                    context.SaveChanges();

                    Response.Redirect("Default");
                }
            }
        }
        // This is the Update methd to update the selected Cliente item
        // USAGE: <asp:FormView UpdateMethod="UpdateItem">
        public void UpdateItem(int cd_cliente)
        {
            using (var context = new renan004Context())
            {
                var item = context.Cliente.Find(cd_cliente);

                if (item == null)
                {
                    // The item wasn't found
                    ModelState.AddModelError("", String.Format("Item with id {0} was not found", cd_cliente));
                    return;
                }

                TryUpdateModel(item);

                if (ModelState.IsValid)
                {
                    // Save changes here
                    context.SaveChanges();
                    Response.Redirect("../Default");
                }
            }
        }