using Ropin.Inspection.Model.Entities; using Ropin.Inspection.Model.ViewModel; using Ropin.Inspection.Repository.Interface; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; namespace Ropin.Inspection.Repository { public class TsysUserPostRepository : RepositoryBase, ITsysUserPostRepository { public TsysUserPostRepository(InspectionDbContext dbContext) : base(dbContext) { } public Task DeleteByUserAsync(Guid userId) { MySqlConnector.MySqlParameter[] parameters = new[] { new MySqlConnector.MySqlParameter("Id", userId) }; int result = EntityFrameworkCoreExtensions.ExecuteSqlNoQuery(DbContext.Database, "DELETE from TSYS_UserPost WHERE G_UserCode = @Id", parameters); return Task.FromResult(result); } public Task GetUserPostsByUserIdAsync(Guid userId) { var v = DbContext.TSYS_UserPost.Where(n => n.G_UserCode == userId).FirstOrDefault(); return Task.FromResult(v); } } }