public static async Task <int> InsertShopEmployeeVoteAsync(ShopEmployeeVoteModel model) { using (var cmd = new SqlCommand(@"INSERT Activity.dbo.tbl_ShopEmployeeVote ( ShopId,EmployeeId,ImageUrls,Name,Age,City,YearsEmployed,Hobby,ExpertiseModels,ExpertiseProjects,Description,VideoUrl,CreateTime) VALUES(@shopId,@employeeId,@imageUrls,@name,@age,@city,@yearsEmployed,@hobby,@expertiseModels,@expertiseProjects,@description,@videoUrl,GETDATE())") ) { cmd.Parameters.AddWithValue("@shopId", model.ShopId); cmd.Parameters.AddWithValue("@employeeId", model.EmployeeId); cmd.Parameters.AddWithValue("@imageUrls", model.ImageUrls); cmd.Parameters.AddWithValue("@name", model.Name); cmd.Parameters.AddWithValue("@age", model.Age); cmd.Parameters.AddWithValue("@city", model.City); cmd.Parameters.AddWithValue("@yearsEmployed", model.YearsEmployed); cmd.Parameters.AddWithValue("@hobby", model.Hobby); cmd.Parameters.AddWithValue("@expertiseModels", model.ExpertiseModels); cmd.Parameters.AddWithValue("@expertiseProjects", model.ExpertiseProjects); cmd.Parameters.AddWithValue("@description", model.Description); cmd.Parameters.AddWithValue("@videoUrl", model.VideoUrl); return(await DbHelper.ExecuteNonQueryAsync(cmd)); } }
///<summary>技师报名</summary>/// public async Task <OperationResult <bool> > AddEmployeeSignUpAsync(ShopEmployeeVoteModel model) { try { //验证是否可以反序列化,保证数据有效 JsonConvert.DeserializeObject <JArray>(model.ImageUrls); var check = await CheckEmployeeSignUpAsync(model.ShopId, model.EmployeeId); if (check.Result) { return(OperationResult.FromResult(true)); } else { var result = await SexAnnualVoteManager.InsertShopEmployeeVoteAsync(model); return(OperationResult.FromResult(result.Result)); } } catch (Exception e) { return(OperationResult.FromError <bool>("0", e.Message)); } }
public static async Task <OperationResult <bool> > InsertShopEmployeeVoteAsync(ShopEmployeeVoteModel model) { return(OperationResult.FromResult(await DalSexAnnualVote.InsertShopEmployeeVoteAsync(model) > 0)); }