public override string[] GetRolesForUser(string username)
        {
            PanaderiaEntities db   = new PanaderiaEntities();
            string            data = db.usuario.Where(x => x.nombre == username).FirstOrDefault().rolusuario.rol;

            string[] result = { data };
            return(result);
        }
        public ActionResult Login(usuario model, string returnUrl)
        {
            PanaderiaEntities db = new PanaderiaEntities();
            var dataItem         = db.usuario.Where(x => x.nombre == model.nombre && x.clave == model.clave).First();

            if (dataItem != null)
            {
                FormsAuthentication.SetAuthCookie(dataItem.nombre, false);
                if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                    !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                {
                    return(Redirect(returnUrl));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                ModelState.AddModelError("", "Invalid user/pass");
                return(View());
            }
        }