public async Task <int> Create(CreateWeightRequest request) { var weights = new WeightVehicle.Data.Entity.Weight() { deliveryCode = request.deliveryCode, moocCode = request.moocCode, sealCount = request.sealCount, sealDes = request.sealDes, lotNumber = request.lotNumber }; _weightDbContext.Weights.Add(weights); return(await _weightDbContext.SaveChangesAsync()); }
public async Task <int> Add(CreateAccountUser request) { if (await _weightDBContext.Users.FindAsync(request.id) != null) { throw new Exception("CMND da ton tai"); } else { var users = new WeightVehicle.Data.Entity.User() { id = request.id, firstName = request.firstName, lastName = request.lastName, DoB = request.DoB, userName = request.userName, passWord = request.passWord, email = request.email, phoneNumber = request.phoneNumber, }; _weightDBContext.Users.Add(users); return(await _weightDBContext.SaveChangesAsync()); } }