public Lead Update(Lead lead) { var sqlQuery = "UPDATE Lead " + "SET FirstName = @FirstName, " + " LastName = @LastName, " + " Email = @Email, " + " Phone = @Phone, " + " Course = @Course, " + " Notes = @Notes, " + " SalesRepId= @SalesRepId " + "WHERE Id = @Id"; this._db.Execute(sqlQuery, lead); return lead; }
public Lead Add(Lead lead) { var sqlQuery = "INSERT INTO Lead" + "(FirstName, " + "LastName, " + "Email, " + "Phone, " + "Course, " + "SalesRepId, " + "Notes, " + "CreateDate) VALUES" + "(@FirstName, " + "@LastName, " + "@Email, " + "@Phone, " + "@Course, " + "@SalesRepId, " + "@Notes, " + "@CreateDate)" + "SELECT CAST(SCOPE_IDENTITY() as int)"; var userId = this._db.Query<int>(sqlQuery, lead).Single(); lead.Id = userId; return lead; }