public static void CreateFranchize(user_franchaser uf) { using (DALContext cnx = new DALContext()) { cnx.user_franchaser.AddObject(uf); cnx.SaveChanges(); } }
public ActionResult CreateFranchize(NewFranchize fch) { if (ModelState.IsValid) { try { MembershipUser mu = Membership.CreateUser(fch.Email, fch.Password, fch.Email); if (mu != null) { System.Web.Security.Roles.AddUserToRole(fch.Email, "franchize"); user_franchaser newFranchizer = new user_franchaser { first_name = fch.FirstName, last_name = fch.LastName, company_name = fch.CompanyName, country = fch.Country, domain_name = fch.DomainName, email = fch.Email, telephone = fch.Phone, user_id = (string)mu.ProviderUserKey }; DataManager.CreateFranchize(newFranchizer); } } catch (MembershipCreateUserException muex) { TempData["Error"] = Helper.GetMembershipUserCreateStatus(muex.StatusCode); } catch (Exception ex) { TempData["Error"] = ex.Message; } } return RedirectToAction("CreateFranchize"); }
/// <summary> /// Устаревший метод для добавления новых объектов в набор EntitySet user_franchaser. Взамен можно использовать метод .Add связанного свойства ObjectSet<T>. /// </summary> public void AddTouser_franchaser(user_franchaser user_franchaser) { base.AddObject("user_franchaser", user_franchaser); }
/// <summary> /// Создание нового объекта user_franchaser. /// </summary> /// <param name="id">Исходное значение свойства id.</param> /// <param name="user_id">Исходное значение свойства user_id.</param> /// <param name="first_name">Исходное значение свойства first_name.</param> /// <param name="last_name">Исходное значение свойства last_name.</param> /// <param name="company_name">Исходное значение свойства company_name.</param> /// <param name="telephone">Исходное значение свойства telephone.</param> /// <param name="email">Исходное значение свойства email.</param> /// <param name="domain_name">Исходное значение свойства domain_name.</param> /// <param name="country">Исходное значение свойства country.</param> public static user_franchaser Createuser_franchaser(global::System.Int32 id, global::System.String user_id, global::System.String first_name, global::System.String last_name, global::System.String company_name, global::System.String telephone, global::System.String email, global::System.String domain_name, global::System.String country) { user_franchaser user_franchaser = new user_franchaser(); user_franchaser.id = id; user_franchaser.user_id = user_id; user_franchaser.first_name = first_name; user_franchaser.last_name = last_name; user_franchaser.company_name = company_name; user_franchaser.telephone = telephone; user_franchaser.email = email; user_franchaser.domain_name = domain_name; user_franchaser.country = country; return user_franchaser; }