///// <summary> ///// Inserts/updates a param ///// </summary> ///// <param name="name">The name</param> ///// <param name="value">The value</param> ///// <param name="description">The description</param> ///// <returns>Setting</returns> //public Mis_Play SetParam(string name, string value, string memo) //{ // var mMisSetting = this.GetSettingByName(name); // if (mMisSetting == null) // mMisSetting = Insert(name, value, memo); // else // mMisSetting = Update(mMisSetting.Id, name, value, memo); // return mMisSetting; //} #region CRUD Methods /// <summary> /// Insert a new record /// </summary> /// <param name="musicName">music name</param> /// <param name="musicUrl">music url</param> /// <returns>the new object</returns> public Mis_Play Insert(string musicName, string musicUrl) { var mMisPlay = _context.Mis_Play.CreateObject(); mMisPlay.MusicName = musicName; mMisPlay.MusicUrl = musicUrl; mMisPlay.PlayUserId = CRMContext.Current.User.CustomerID.ToString(); mMisPlay.PlayUserName = CRMContext.Current.User.Username; _context.Mis_Play.AddObject(mMisPlay); _context.SaveChanges(); return(mMisPlay); }
/// <summary> /// Insert a new record /// </summary> /// <param name="name">setting's name</param> /// <param name="value">setting's value</param> /// <param name="memo">setting's memo</param> /// <returns>the new object</returns> public Mis_Setting Insert(string name, string value, string memo) { name = CommonHelper.EnsureNotNull(name); name = CommonHelper.EnsureMaximumLength(name, 200); value = CommonHelper.EnsureNotNull(value); value = CommonHelper.EnsureMaximumLength(value, 2000); memo = CommonHelper.EnsureNotNull(memo); var mMisSetting = _context.Mis_Setting.CreateObject(); mMisSetting.Name = name; mMisSetting.Value = value; mMisSetting.Memo = memo; _context.Mis_Setting.AddObject(mMisSetting); _context.SaveChanges(); return(mMisSetting); }