public bool registerUser(string clientid, int appid, string handset_model, string handset_manufacturer, string handset_product) { var user = new appuser { AppID = appid, HandsetID = clientid, HandsetModel = handset_model, HandsetManufacturer = handset_manufacturer, HandsetProduct = handset_product, RegisterTimestamp = DateTime.Now }; try { if (checkUserRegistration(clientid, appid)) { var c_user = (from u in _db.appusers where (u.HandsetID == clientid && u.AppID == appid) select u).FirstOrDefault(); var removersvps = from r in _db.rsvps where (r.UserID == c_user.UserID) select r; foreach (var c_rsvp in removersvps) { _db.rsvps.DeleteObject(c_rsvp); } _db.appusers.DeleteObject(c_user); } _db.appusers.AddObject(user); _db.SaveChanges(); } catch (Exception e) { return false; } return true; }
/// <summary> /// Create a new appuser object. /// </summary> /// <param name="userID">Initial value of the UserID property.</param> /// <param name="appID">Initial value of the AppID property.</param> /// <param name="handsetID">Initial value of the HandsetID property.</param> public static appuser Createappuser(global::System.Int32 userID, global::System.Int32 appID, global::System.String handsetID) { appuser appuser = new appuser(); appuser.UserID = userID; appuser.AppID = appID; appuser.HandsetID = handsetID; return appuser; }
/// <summary> /// Deprecated Method for adding a new object to the appusers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToappusers(appuser appuser) { base.AddObject("appusers", appuser); }