public void Add(Product entity) { using (IDbConnection cn = connection) { var parameters = new { Name = entity.Name, Id = entity.Id }; cn.Open(); entity.Id = cn.Query<Guid>( "INSERT INTO Products (Name, Id) VALUES(@Name, @Id)", parameters).FirstOrDefault(); } }
public void Add(PricingQuery entity) { using (IDbConnection cn = connection) { var parameters = new { UserId = entity.UserId, ProductId = entity.ProductId, EnquiryDate = entity.EnquiryDate, RespondedDate = entity.RespondedDate, IsReplied = entity.IsReplied, Id = entity.Id, }; cn.Open(); entity.Id = cn.Query<Guid>( "INSERT INTO PricingQuery (UserId, ProductId, EnquiryDate, RespondedDate, IsReplied, Id) VALUES(@UserId, @ProductId, @EnquiryDate, @RespondedDate, @IsReplied, @Id)", parameters).FirstOrDefault(); } }
public void Update(User entity) { using (IDbConnection cn = connection) { var parameters = new { FirstName = entity.FirstName, LastName = entity.LastName, Email = entity.Email, AddressLine1 = entity.AddressLine1, City = entity.City, PostCode = entity.PostCode, Country = entity.Country, Phone = entity.Phone, Id = entity.Id }; cn.Open(); cn.Execute( "UPDATE Users SET FirstName=@FirstName, LastName=@LastName, Email=@Email, AddressLine1=@AddressLine1, City=@City, PostCode=@PostCode, Country=@Country, Phone = @Phone WHERE Id=@Id", parameters); } }
public void Add(User entity) { using (IDbConnection cn = connection) { var parameters = new { FirstName = entity.FirstName, LastName = entity.LastName, Email = entity.Email, AddressLine1 = entity.AddressLine1, City = entity.City, PostCode = entity.PostCode, Country = entity.Country, Phone = entity.Phone, Id = entity.Id }; cn.Open(); entity.Id = cn.Query<Guid>( "INSERT INTO Users (FirstName, LastName, Email, AddressLine1,City,PostCode,Country,Phone, Id) VALUES(@FirstName, @LastName, @Email, @AddressLine1,@City,@PostCode,@Country,@Phone, @Id)", parameters).FirstOrDefault(); } }