public ActionResult Reg(string login, string password, string name, DateTime? bithdate, string phone)
 {
     User user = HotelContext.Registration(new User { Login = login, Password = password });
     if (user == null)
         return JavaScript("alert('user with this login already exists, please try again');");
     Client cl = new Client
     {
         UserID = user.UserID,
         PersonalData = name,
     };
     if (bithdate.HasValue)
         cl.BirthDate = bithdate.Value;
     if (phone != null)
         cl.Phone = phone;
     HotelContext.AddClient(cl);
     cl = HotelContext.SignIn(user);
     return Json(new { id = cl.ClientID, name = cl.PersonalData }, JsonRequestBehavior.AllowGet);
 }
 /// <summary>
 /// Create a new Client object.
 /// </summary>
 /// <param name="clientID">Initial value of the ClientID property.</param>
 /// <param name="userID">Initial value of the UserID property.</param>
 /// <param name="personalData">Initial value of the PersonalData property.</param>
 /// <param name="phone">Initial value of the Phone property.</param>
 public static Client CreateClient(global::System.Int32 clientID, global::System.Int32 userID, global::System.String personalData, global::System.String phone)
 {
     Client client = new Client();
     client.ClientID = clientID;
     client.UserID = userID;
     client.PersonalData = personalData;
     client.Phone = phone;
     return client;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Clients EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToClients(Client client)
 {
     base.AddObject("Clients", client);
 }