m0_58590380
2022-01-04 13:44
采纳率: 60%
浏览 20

linq的怎么写获取前台value值

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
            <div class="field">
                <select   name="Language" id="Lang-list" class="input" value="@Model.Language">
                    <option value="0">中文</option>
                    <option value="1">英文</option>
                </select>
            </div>




    /// <param name="id"></param>
    /// <param name="CorpId"></param>
    /// <returns></returns>
    public int SaveProjectDataInfo(string id, string CorpId,int Language)
    {
        try
        {
            using (IRepository<WB_PERSONALSETTINGS> repository = ServeiceCore.GetServiceFactory.GetInstance<IRepository<WB_PERSONALSETTINGS>>(ServiceName.IRepository))
            {
                var userid = new Guid(id);
                var epid = new Guid(CorpId);;
                var query = repository.GetDbContext.Set<WB_PERSONALSETTINGS>().Where(t => t.ID == userid).FirstOrDefault();

                if (query != null)
                    {
                   query.Language = 0;
                        {
                            repository.UpdateEntity<WB_PERSONALSETTINGS>(query, "Language");
                            repository.SaveChangesInt();
                        }
                    }
                repository.SaveChangesInt();
            }
            return 1;
        }
        catch (Exception ex)
        {
            LogHelper.Error("SaveProjectDataInfo", ex);
            return -1;
        }
    }
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果

1条回答 默认 最新

相关推荐 更多相似问题