public void Update(int id)
 {
     estatesnEntities ee = new estatesnEntities();
     SiteUser u = (from user in ee.SiteUser where user.UserID == id select user).First<SiteUser>();
     u.FIO = Request.Form["FIO"];
     u.Country.CountryID = int.Parse(Request.Form["CountryID"]);
     ee.SaveChanges();
     RedirectToAction(new { Action = "Edit", ID = u.UserID });
 }
Ejemplo n.º 2
0
        public void RaiseCallbackEvent(string eventArgument)
        {
            estatesnEntities ee = new estatesnEntities();
            var c = from user in ee.SiteUser
                    where user.UserName.ToLower() == eventArgument.Trim().ToLower()
                    select user;

            if (c.Count<SiteUser>() > 0)
                checkResult = "Пользователь существует";
            else
                checkResult = "OK";
        }
Ejemplo n.º 3
0
        public void Index(int? id)
        {
            if (!id.HasValue) id = 4;

            estatesnEntities ee = new estatesnEntities();
            var u = from user in ee.SiteUser where user.UserID == id select user;

            UserIndexViewData vd = new UserIndexViewData();
            vd.User = u.First<SiteUser>();
            vd.User.CountryReference.Load();
            vd.Countries = (from c_country in ee.C_Country select c_country).ToList<Country>();
            RenderView("Index", vd);
        }
Ejemplo n.º 4
0
        public void Create(string userName, string email, string password1, string password2)
        {
            SiteUser u = new SiteUser();
            u.UserName = userName;
            u.EMail = email;
            u.Password = password1;
            estatesnEntities ee = new estatesnEntities();
            ee.AddToSiteUser(u);
            ee.SaveChanges();

            if (Membership.CreateUser(userName, password1, email) == null)
                throw new MembershipCreateUserException("An unspecified error occurred.");

            FormsAuthentication.SetAuthCookie(userName, true);
            Response.Redirect("/");
        }
        public void GetByCountry(string countryID)
        {
            int id = 0;
            if (!int.TryParse(countryID, out id)) return;

            estatesnEntities ee = new estatesnEntities();

            var c = from reg in ee.C_Region
                    where reg.Country.CountryID == id
                    select reg;

            StringBuilder res = new StringBuilder();
            res.Append("{\"\":\"\"");
            foreach (Region r in c)
            {
                res.Append(",\"").Append(r.RegionID).Append("\":\"")
                    .Append(r.RegionName).Append("\"");
            }
            res.Append("}");

            Response.AppendHeader("Content-type", "text/javascript");
            Response.Write(res.ToString());
        }
 public void Edit(int id)
 {
     estatesnEntities ee = new estatesnEntities();
     var u = from user in ee.SiteUser where user.UserID == id select user;
     RenderView("Edit", u.First<SiteUser>());
 }