Пример #1
0
        public object Create([Bind(Include = "id,Email,Password,Name,LName,Cedula,BirthDate,Age,Genre,Address,CellPhoneNumber,ProfilePhoto,Afiliated,MemberShipType,MemberShipState,WorkPlace,OfficeAddress,OfficeTelNumber,DateSignIn,DateSignOut")] SociosClubTable sociosClubTable, HttpPostedFileBase profileimage)
        {
            if (ModelState.IsValid)

            {
                if (sociosClubTable.MemberShipType.Equals("Ninguna"))
                {
                    sociosClubTable.MemberShipState = ("Inactivada");
                    sociosClubTable.DateSignIn      = Convert.ToString(DateTime.Now);
                    sociosClubTable.DateSignOut     = "No se ha activado una Membresia";
                }
                else if (sociosClubTable.MemberShipType.Equals("Basica") || sociosClubTable.MemberShipType.Equals("Premium"))
                {
                    sociosClubTable.MemberShipState = ("Activada");
                    sociosClubTable.DateSignIn      = (Convert.ToString(DateTime.Now));
                }

                if (profileimage != null)
                {
                    string filename  = Path.GetFileNameWithoutExtension(profileimage.FileName);
                    string extension = Path.GetExtension(profileimage.FileName);
                    filename = filename + DateTime.Now.ToString("yymmssfff") + extension;
                    sociosClubTable.ProfilePhoto = "~/Image/" + filename;
                    filename = Path.Combine(Server.MapPath("~/Image/"), filename);
                    profileimage.SaveAs(filename);
                }
                db.SociosClubTableSet.Add(sociosClubTable);
                db.SaveChanges();
                return(RedirectToAction("Index", "Login"));
            }

            return(View(sociosClubTable));
        }
        public ActionResult Create([Bind(Include = "id,Name,LName,Email,Password")] UserTable userTable)
        {
            if (ModelState.IsValid)
            {
                db.UserTable.Add(userTable);
                db.SaveChanges();
                return(RedirectToAction("Index", "Login"));
            }

            return(View(userTable));
        }
        public ActionResult Create([Bind(Include = "id,Email,Password")] AdminsTable adminsTable)
        {
            if (ModelState.IsValid)
            {
                db.AdminsTable.Add(adminsTable);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(adminsTable));
        }