Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SOCIO sOCIO = db.SOCIO.Find(id);

            db.SOCIO.Remove(sOCIO);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "SOC_ID,SOC_CEDULA,SOC_NOMBRE,SOC_DIRECCION,SOC_TELEFONO,SOC_CORREO")] SOCIO sOCIO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sOCIO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sOCIO));
 }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "SOC_ID,SOC_CEDULA,SOC_NOMBRE,SOC_DIRECCION,SOC_TELEFONO,SOC_CORREO")] SOCIO sOCIO)
        {
            if (ModelState.IsValid)
            {
                db.SOCIO.Add(sOCIO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sOCIO));
        }
Exemplo n.º 4
0
        // GET: SOCIOs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SOCIO sOCIO = db.SOCIO.Find(id);

            if (sOCIO == null)
            {
                return(HttpNotFound());
            }
            return(View(sOCIO));
        }
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    result = await UserManager.AddToRoleAsync(user.Id, model.RoleName);

                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);


                    if (result.Succeeded)
                    {
                        var db = new dbClub();

                        var socio = new SOCIO
                        {
                            ID_SOCIO = user.Id,
                            APELLIDO = model.Apellido,
                            NOMBRE   = model.Nombre,
                            DNI      = model.DNI,
                        };
                        db.SOCIO.Add(socio);
                        db.SaveChanges();

                        // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                        // Send an email with this link
                        // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                        // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                        // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                        return(RedirectToAction("Index", "Home"));
                    }
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }