// This is the Select methd to selects a single Cliente item with the id
        // USAGE: <asp:FormView SelectMethod="GetItem">
        public renan004.Models.Cliente GetItem([FriendlyUrlSegmentsAttribute(0)]int? cd_cliente)
        {
            if (cd_cliente == null)
            {
                return null;
            }

            using (var context = new renan004Context())
            {
                return context.Cliente.Find(cd_cliente);
            }
        }
        // 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");
                }
            }
        }
        // Model binding method to get List of Cliente entries
        // USAGE: <asp:ListView SelectMethod="GetData">
        public IQueryable<Cliente> GetData()
        {
            var context = new renan004Context();

            return context.Cliente;
        }